-
Notifications
You must be signed in to change notification settings - Fork 22
feat: Added Range Slider Example #351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Added custom range slider code to markdown-content.tsx - Uncommented range slider component in Developer Notes
Range slider now updates the value in the input
| max="11" | ||
| value="10" | ||
| max="10" | ||
| step="1"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no styling here yet, but if the functionality checks out, I can spice it up.
| export const getMarkdownFunctionMap = ( | ||
| navigate: NavigateFunction | ||
| ): Record<string, (event: React.MouseEvent<Element>) => void> => ({ | ||
| ): Record<string, (event: React.SyntheticEvent) => void> => ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed MouseEvent to SyntheticEvent to generalize the Markdown function handler type to accept any React synthetic event. This allows buttons/links/divs (mouse events) and inputs (form/change events) are all supported consistently.
While creating the script for this, I noticed that the previous version that shows up on internet archive did not sync the slider with the text. I'm guessing the originally it did work. I added this code in, but I changed the range slider text input to a span. Leaving it a text input would imply that the user could type something in the input and it would update the slider. We could do this too, but I though that was a lot of code bloat that doesn't serve the purpose that the example is trying to show. making it a span makes it read only.
My question is, should we add a live region to this to make it accessible and update the example to reflect?