LG-12126 address buttons for inline MFA editing on mobile devices#9969
LG-12126 address buttons for inline MFA editing on mobile devices#9969kevinsmaster5 merged 2 commits intomainfrom
Conversation
…A rename and delete buttons display
|
Typically we could style buttons this way with For example: <button class="usa-button usa-button--unstyled tablet:display-none">...</button>
<button class="usa-button display-none tablet:display-inline-block">...</button> |
I went back and forth a little on that idea addressing it in the erb instead of the stylesheet. Personally I like to avoid adding extra hidden markup to accommodate screen size. I got the bulk of the styles from that button-unstyled class where it's being used on the Manage button. If using those alternating visibility duplicate elements is more normal for our codebase here I can defer to that. |
|
I'd be wary of duplicating the source of truth of the styles, since it's quite likely that USWDS will update styles for unstyled buttons, and I wouldn't want to have us worry about keeping them in sync. In my previous comment, I'd meant to link specifically to the Otherwise, my vote would be for duplicating the markup to toggle at different viewports. We have plenty of examples of this elsewhere in the code. I think the main complication would be that the JavaScript associated with this component is binding events to specific elements, which may become complicated if we have multiple elements with those classes. That'd be a good opportunity for an event delegation pattern, though we don't really have this readily available in native JS or existing libraries at our disposal. We already pull in e.g. // Before:
this.querySelector('.manageable-authenticator__rename-button').addEventListener('click', /* ... */);
// After:
this.querySelectorAll('.manageable-authenticator__rename-button').forEach((element) => {
element.addEventListener('click', /* ... */);
}); |
OIC. The mixin looks like it's working great with just a slight additional tweak. Do you recommend pushing on to revising the markup and JS? |
|
I think the mixin is a great approach if it works 👍 |
🎫 Ticket
Link to the relevant ticket:
LG-12126
🛠 Summary of changes
Adds appropriate media-based override to scss file pertaining to manageable authenticator component.
Rename, Delete, Done, Save, and Cancel buttons remove default button component styling.
👀 Screenshots
Before:
After: