spectrum-css icon indicating copy to clipboard operation
spectrum-css copied to clipboard

The slider controls margin makes it harder to implement click logic correctly.

Open adixon-adobe opened this issue 4 years ago • 6 comments

Description

I'm opening this out of https://github.com/adobe/spectrum-web-components/issues/653 as this makes it harder to properly implement the slider, leading to bugs where you can't actually click to the edge in implementations.

Expected behavior

No margin in the controls so the width matches the actual track width. If this is harder to fix, it'd be good to have some additional advice on the doc pages for implementations.

Screenshots

Screen Shot 2020-04-30 at 11 44 12 AM

synced to jira: https://jira.corp.adobe.com/browse/CSS-217

adixon-adobe avatar Apr 30 '20 16:04 adixon-adobe

IIRC this is done because we need to be able to drop the slider off the edge of the track, and we don't want the handle to overlap things.

This could be done differently, but I believe it would cause complications in how the handles are positioned. Perhaps wrap the slider itself in a div and listen for clicks on that?

lazd avatar Apr 30 '20 17:04 lazd

I just checked in with @badimon - We shouldn't have the margin. It isn't super clear in the design docs, but the edge of the handle should go to the edge of the track.

GarthDB avatar Apr 30 '20 17:04 GarthDB

Like @lazd mentioned, it was done intentionally at first, but design ended up going with a different decision.

GarthDB avatar Apr 30 '20 17:04 GarthDB

And just to make sure I don't cause additional confusion, the handle really does go to the edge of the track, it's just that because of the margin, it's easy to lose click events at the very edge of the track.

adixon-adobe avatar Apr 30 '20 17:04 adixon-adobe

@adixon-adobe Is there a place where we could verify if this is still an issue? We can check again with design folks and fix if it's still an issue.

pfulton avatar Jul 11 '22 17:07 pfulton

Here's a screenshot of some of the override css we have in place for the web component (which probably has a touch more than needed for this issue). My hunch looking at the Spectrum CSS site is that this will still be an issue, because the controls are not the full width of the track. I won't have time to confirm directly for at least a few weeks though.

override-css

adixon-adobe avatar Jul 12 '22 15:07 adixon-adobe

@adixon-adobe I believe this has been resolved in the slider token migration branch. When you have a chance, would you mind taking a look and making sure this resolves the issue you found? https://pr-1547--spectrum-css.netlify.app/docs/slider.html

castastrophe avatar Mar 07 '23 14:03 castastrophe

@castastrophe I think this covers it. I'd recommend making a really wide slider with more ticks to test that you have the alignment logic correct there (unless that's just faked for the spectrum css site). It looks like the alignment might be very slightly off for ticks closer to the edge.

adixon-adobe avatar Mar 07 '23 15:03 adixon-adobe

Oh, and fwiw I just logged https://github.com/adobe/spectrum-web-components/issues/2990 on slider alignment.

adixon-adobe avatar Mar 07 '23 16:03 adixon-adobe

Oh great call-out on the edge alignment. I'll make sure that's included in our QA.

castastrophe avatar Mar 07 '23 16:03 castastrophe

Slider Migration PR in SWC: https://github.com/adobe/spectrum-web-components/pull/2905

pfulton avatar May 19 '23 16:05 pfulton

Closing this as the PR in question #2095 was merged successfully.

castastrophe avatar Nov 13 '23 19:11 castastrophe