Skip to content
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

[meter] Create Meter component #743

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mj12albert
Copy link
Member

@mj12albert mj12albert commented Oct 17, 2024

Closes: #662

Demo: https://deploy-preview-743--base-ui.netlify.app/components/react-meter/

Summary

  • Does not use the meter element due to cross-browser inconsistencies, attributes like optimum actually make the VO experience worse 1, styling is also annoying 2
  • Uses the same anatomy as Progress since they are closely related
  • Implements the "high/medium/low segmenting" feature from the HTML spec - the high/low props can be used to set the boundaries between the 3 segments, and sets a data-segment attribute indicating which segment the current value falls in. Due to inconsistent and incorrect browser implementations of this feature, we assume the prop value is inclusive 3
  • The value of the optimum prop, in combination with segmenting, indicates which segment of the range is "preferred". If the current value is in the preferred segment, a [data-optimum] attribute is set

Footnotes

  1. https://www.htmhell.dev/adventcalendar/2022/5/

  2. https://scottaohara.github.io/a11y_styled_form_controls/src/meter/

  3. https://www.ctrl.blog/entry/html-meter-segment-boundaries.html

@mui-bot
Copy link

mui-bot commented Oct 17, 2024

Netlify deploy preview

https://deploy-preview-743--base-ui.netlify.app/

Generated by 🚫 dangerJS against e7386f8

@mj12albert mj12albert force-pushed the feat/meter branch 3 times, most recently from d8734f9 to e927c2d Compare October 18, 2024 07:17
@mj12albert mj12albert added the new feature New feature or request label Oct 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: meter new feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[meter] Implement Meter
2 participants