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

fix(slider): focus state matches spec, supports forced-colors #2217

Merged
merged 14 commits into from
Nov 9, 2023

Conversation

mdt2
Copy link
Collaborator

@mdt2 mdt2 commented Oct 17, 2023

Description

This PR addresses issue #2200.

  • Adjust focus state to match the spec (previously it looked like the active state which was incorrect)
  • Standard variant works in high contrast mode. See Xd file in spec for reference.
  • Disabled slider has the default cursor on hover. This was already set in a couple places (.spectrum-Slider and .spectrum-Slider-handle) but needed to be explicitly set on .spectrum-Slider-controls to take effect since this class has a specified cursor: pointer when the slider isn't disabled.

How and where has this been tested?

Please tag yourself on the tests you've marked complete to confirm the tests have been run by someone other than the author.

Validation

  • On focus, the slider handle should match the spec (it shouldn't be filled in and should have a focus ring). Confirm this for high contrast mode as well
  • On hover in high contrast mode, the slider track and handle are the Highlight color
  • On active/dragged in high contrast mode, the handle fills in with Highlight to match the spec
  • Disabled sliders should get the default cursor on hover
  • Focus and disabled states are documented on the docs site

Regression testing

Validate:

  1. A legacy documentation page (such as accordion), including:
  • The page renders correctly
  • The page is accessible
  • The page is responsive
  1. A migrated documentation page (such as action group), including:
  • The page renders correctly
  • The page is accessible
  • The page is responsive

To-do list

  • I have read the contribution guidelines.

  • I have updated relevant storybook stories and templates.

  • I have tested these changes in Windows High Contrast mode.

  • If my change impacts other components, I have tested to make sure they don't break.

  • If my change impacts documentation, I have updated the documentation accordingly.

  • ✨ This pull request is ready to merge. ✨

@github-actions
Copy link
Contributor

github-actions bot commented Oct 17, 2023

🚀 Deployed on https://pr-2217--spectrum-css.netlify.app

@github-actions github-actions bot temporarily deployed to pull request October 17, 2023 14:12 Inactive
@mdt2 mdt2 requested review from jawinn and jenndiaz October 17, 2023 14:20
@github-actions github-actions bot temporarily deployed to pull request October 17, 2023 14:24 Inactive
Copy link
Collaborator

@jawinn jawinn left a comment

Choose a reason for hiding this comment

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

It's looking much closer to the intended spec now. A few questions and suggestions below.

There doesn't seem to be any indication in the WHCM design spec about how to handle the "Filled", , "Filled-Offset", and "Range". I think perhaps that at least for focus and hover, the darker portion should use the Highlight color (in the PR you can see the reverse of this on "Filled-Offset").
Ideally there'd be a way to differentiate the darkened part of the range by default in WHCM as well, but I'm not sure about the best way; possibly a thicker track since there isn't another appropriate system color to use. But that would need some followup design/a11y involvement/approval.

I also noticed that there are some existing high contrast styles for the ramp that we may want to move next to the rest of the high contrast styles.

components/slider/index.css Outdated Show resolved Hide resolved
components/slider/index.css Outdated Show resolved Hide resolved
components/slider/index.css Outdated Show resolved Hide resolved
@github-actions github-actions bot temporarily deployed to pull request October 23, 2023 16:01 Inactive
@github-actions github-actions bot temporarily deployed to pull request October 23, 2023 18:10 Inactive
@github-actions github-actions bot temporarily deployed to pull request October 24, 2023 14:10 Inactive
@github-actions github-actions bot temporarily deployed to pull request October 24, 2023 17:36 Inactive
@github-actions github-actions bot temporarily deployed to pull request October 24, 2023 17:48 Inactive
@github-actions github-actions bot temporarily deployed to pull request October 24, 2023 18:03 Inactive
@github-actions github-actions bot temporarily deployed to pull request October 24, 2023 20:36 Inactive
@github-actions github-actions bot temporarily deployed to pull request October 24, 2023 21:02 Inactive
@mdt2 mdt2 requested a review from jawinn October 24, 2023 21:06
Comment on lines -520 to -533
.spectrum-Slider {
&.is-disabled {
cursor: default;

.spectrum-Slider-handle {
cursor: default;
pointer-events: none;
}

.spectrum-Slider-tickLabel {
color: var(--highcontrast-slider-label-text-color-disabled, var(--mod-slider-label-text-color-disabled, var(--spectrum-slider-label-text-color-disabled)));
}
}
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Relocated this to an existing spectrum-Slider.is-disabled selector on new line 628

Comment on lines -614 to -620
@media (forced-colors: active) {
/* forced-color-adjust required to ensure the "circle" around the handle is transparent */
forced-color-adjust: none;
box-shadow: 0 0 0 var(--spectrum-slider-handle-gap) ButtonFace;
border-color: ButtonText;
background-color: ButtonFace;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We can rely on the --highcontrast custom properties to do this instead.

@github-actions github-actions bot temporarily deployed to pull request October 25, 2023 18:46 Inactive
@github-actions github-actions bot temporarily deployed to pull request October 25, 2023 20:00 Inactive
Copy link
Collaborator

@jawinn jawinn 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 to me! Thanks for those updates.
I only have one small recommendation to move a few lines of CSS.

components/slider/index.css Outdated Show resolved Hide resolved
@github-actions github-actions bot temporarily deployed to pull request October 27, 2023 14:41 Inactive
@github-actions github-actions bot temporarily deployed to pull request October 27, 2023 15:04 Inactive
Copy link
Collaborator

@pfulton pfulton left a comment

Choose a reason for hiding this comment

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

This looks great. Thanks for taking care of this.

@pfulton
Copy link
Collaborator

pfulton commented Oct 27, 2023

@najikahalsema @majornista This work should address #2200. Would you mind taking a look to be sure that we've fixed everything? PR deploy is here: https://pr-2217--spectrum-css.netlify.app/

@najikahalsema
Copy link

Looks good to me! Thanks for doing this work.

@mdt2 mdt2 marked this pull request as ready for review October 29, 2023 23:34
@github-actions github-actions bot temporarily deployed to pull request November 8, 2023 21:56 Inactive
@pfulton pfulton added the run_vrt For use on PRs looking to kick off VRT label Nov 9, 2023
@github-actions github-actions bot removed the run_vrt For use on PRs looking to kick off VRT label Nov 9, 2023
@github-actions github-actions bot temporarily deployed to pull request November 9, 2023 15:13 Inactive
@pfulton
Copy link
Collaborator

pfulton commented Nov 9, 2023

@castastrophe Noting that this one will have some Docs changes!

@pfulton pfulton merged commit 7b9c31b into main Nov 9, 2023
4 checks passed
@pfulton pfulton deleted the mdt2/css-620-slider-focus branch November 9, 2023 15:18
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.

None yet

4 participants