10up / wp-component-library

A library of barebones front-end components built with WordPress and accessibility in mind.
https://baseline.10up.com
MIT License
269 stars 42 forks source link

New Component: Reading Position Indicator #210

Open timwright12 opened 5 years ago

timwright12 commented 5 years ago

Like this but no jquery https://css-tricks.com/reading-position-indicator/

timwright12 commented 4 years ago

https://codepen.io/timwright12/pen/zYxPqzE?editors=0010

fabiankaegy commented 4 years ago

Initial Thoughts

requirements

questions

Regarding the last questions there are, I believe, two main considerations. If we allow the user / developer to place the markup for the progress element on the page somewhere it makes it more flexible for them. On the other hand the progress element will be useless when js is disabled and therefore it would make sense to add it form the js. Maybe passing in a container or sibling selector would be an idea how to meet both considerations.

@timwright12 would love to hear your thoughts on these questions

timwright12 commented 4 years ago

@fabiankaegy

  1. Having start and end elements would be great, we can default to full page
  2. sure
  3. sure
  4. callbacks can generally follow the same format we normally use, maybe "scrollstart" "scrolling" and "scrollend"? Each reporting the percentage
  5. we should allow for multiple, but just from a programmatic standpoint (anti-breaking) as the use case it pretty slim
  6. that's a great question. Since we can't really control the HTML used let's check to see if it's a progress element, if not add role="progressbar" to it.

We should also confirm that the bar will move based when using anchor links

fabiankaegy commented 4 years ago

Good catch with the anchor links 👍