opensearch-project / oui

OpenSearch UI Framework
Apache License 2.0
31 stars 66 forks source link

feat: remove Button translations and add inset shadow on active #1285

Closed virajsanghvi closed 2 weeks ago

virajsanghvi commented 2 weeks ago

Description

To avoid buttons physically moving, we've removed the translations on hover/focus and replaced it with an inset shadow (with existing removal of focus/active shadow). We will likely change/refine this behavior in the future, but this removes the weirdness of a physically moving button.

I changed the implementation of ouiSlightShadowActive because there were no active consumers in OUI or OpenSearch Dashboards.

The main downsides of this approach are when background is black and the button is white or a button icon without a border as these cases won't have a super visible change on active.

Item Before (v7dark) After (v7dark) Before (v8dark) After (v8dark)
Button button v7 before button v7 after button v8 before button v8 after
Empty Button (no change) v7 empty before v7 empty after
Button Icon v7 buttonicon before v7 buttonicon after
Toggle Button v7 toggle before v7 toggle after
Button Group (no change) v7 group before v7 group after
Ghost Button v7 ghost before v7 ghost before
Split Button v7 split before v7 split after

fyi: @lauralexis

Issues Resolved

N/A

Check List

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

For more information on following Developer Certificate of Origin and signing off your commits, please check here.

ashwin-pc commented 2 weeks ago

I'm good with removing the movement, but what's the reason for removing the shadow?

virajsanghvi commented 2 weeks ago

I'm good with removing the movement, but what's the reason for removing the shadow?

Adding the inset shadow on active had the effect of disabling the hover outer shadow. This is actually what some other design systems do - the inset basically makes the button looked depressed and the loss of the outer shadow in that state also helps in seeing something changed for colors that make the inset harder to see.

ashwin-pc commented 2 weeks ago

Oh my bad, I assumed that you removed it. That works. Thanks for the clarification