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

feat(web-components): change slider to use Element Internals #31933

Merged

Conversation

marchbox
Copy link
Contributor

@marchbox marchbox commented Jul 5, 2024

Previous Behavior

  • ARIA attributes were added to the host element directly
  • Some APIs are not aligned with <input type=range>

New Behavior

Built based on @chrisdholt’s original changes.

  • Use Element Internals for ARIA and custom states
  • Added form associated properties and methods, e.g. willValidate, reportValidity(), etc.
  • Updating the disabled state on an ancestor <fieldset> element will also update the component’s disabled state, if not explicitly set yet
  • Updating valueTextFormatter will update ariaValueText now.
  • min, max and step are now always string type (but can accept non-string values when setting)
  • Removed readonly support to align with <input type=range> (authors can still add aria-readonly to the component)
  • Added additional test coverage

Related Issue(s)

  • Fixes #

marchbox and others added 30 commits June 24, 2024 19:08
…chbox/fluentui into users/machi/slider-element-internals
@marchbox marchbox closed this Jul 9, 2024
@marchbox marchbox reopened this Jul 9, 2024
@marchbox
Copy link
Contributor Author

marchbox commented Jul 9, 2024

@marchbox can we add an example of using slider within fluent-field so we can have all form controls represented?

@chrisdholt Oh never mind, mis read your message. Yeah I'll add that in Field's story.

@marchbox
Copy link
Contributor Author

marchbox commented Jul 9, 2024

@marchbox can we add an example of using slider within fluent-field so we can have all form controls represented?

I saw there is an example under ComponentExamples story.

Copy link
Member

@mlijanto mlijanto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good @marchbox! I only left a few small comments. Thanks!

packages/web-components/src/slider/slider.ts Outdated Show resolved Hide resolved
packages/web-components/src/slider/slider.ts Outdated Show resolved Hide resolved
packages/web-components/src/slider/slider.ts Outdated Show resolved Hide resolved
packages/web-components/src/slider/slider.ts Outdated Show resolved Hide resolved
@marchbox marchbox merged commit 1b6cc50 into microsoft:master Jul 10, 2024
18 checks passed
@marchbox marchbox deleted the users/machi/slider-element-internals branch July 10, 2024 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants