-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[DO-NOT-MERGE][Button] Add pressed state #984
Conversation
aec47f6
to
d92e215
Compare
d92e215
to
c8e995f
Compare
c8e995f
to
2d83b4b
Compare
@solonaarmstrong @dleroux Could this be tied to the existing |
@dpersing That would be my instinct, too, but from previous experience, it seems we don't allow one prop to have side-effects on another prop and leave it up to the consumer to implement the I was thinking this would be something we could include in the accessibility best practices. It's in the example: https://github.com/Shopify/polaris-react/pull/984/files#diff-7e827730d5a6c8f3eb1be7bfb346d278R263 |
Sounds good! I can add that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make ariaPressed
and pressed
do the same things, and deprecate ariaPressed
? I don’t like having to apply both props either, it seems like a footgun to me. I’m pretty sure we have APIs in other places that change underlying HTML for accessibility reasons, but open to be wrong on this.
I agree, pressed should be sufficient. I should have looked at rails before implementing the ariaPressed. Great opportunity to put in practice our deprecation guidelines :) |
Deprecation it is. 🎉 |
@ry5n Between you and Ben, I feel as though I'm levelling up on my vernacular. |
acf68ea
to
7edd2e3
Compare
54b9882
to
e7adc59
Compare
Cool. I’ll work out some styles for this (probably will closely match what exists in Rails) and post back here today or tomorrow (Feb 12 or 13) |
88a4e53
to
c22aad8
Compare
Sorry these styles took so long. It ended up being best to design them in code, so I could get a feel for the transitions and so on. I pushed up a branch with what I came up with: Design styles for toggle button (#1060) Preview |
c22aad8
to
564db19
Compare
I cherry-picked your commit, @ry5n. Seemed the most straightforward. |
|
||
@media (-ms-high-contrast: active) { | ||
color: ms-high-contrast-color('button-text'); | ||
background: ms-high-contrast-color('button-text-background'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven’t checked if these look good in Windows
Hey everyone, change of plans! I've talked to @ry5n @solonaarmstrong and @danrosenthal, and we're going to take the changes that have been made here, and use them to build a new Some reasoning:
Once I've created the In the meantime, here is a commit to a WIP Leaving this PR open with a DO NOT MERGE for now, we can close it if we decide to keep |
@yourpalsonja @solonaarmstrong I happened to take a look at the new guidelines for deprecation; would be worth looking over if we go ahead with this PR: https://github.com/Shopify/polaris-react/blob/master/documentation/Deprecation%20guidelines.md |
@ry5n Was there something in the deprecation guideline that I missed?
|
The guidelines are new to me, and we would have a deprecation if we went forward with this PR, so I just thought I’d drop a reminder. |
@ry5n @solonaarmstrong Speaking of deprecation, I didn't include the backwards-compatible prop |
It's a different component altogether, so that makes sense to me. |
@ry5n @dpersing @danrosenthal @dleroux How does everyone feel about closing this for now, since |
See notes above. |
Heya folks. I need this for some work in polaris-icons. What will be the best way to bring it back to life? |
This PR specifically, or the ToggleButton in polaris-next? |
I also need this Any ETA and it joining the Polaris family? |
@beefchimi We're planning on putting it in, but are waiting on feedback from a few folks that have grabbed it from |
WHY are these changes introduced?
Resolves #877
Sometimes buttons are used like a radio button, usually in a group but potentially on their own (as a toggle).
WHAT is this pull request doing?
Adds a
pressed
prop with associated styling.There's not much to test, since this is only adding a CSS class.
I added a second commit with pressed states for other buttons. I'm not sure these are needed, so it's easily reversible.
How to 🎩
🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines
Copy-paste this code in
playground/Playground.tsx
:🎩 checklist