Repository navigation
Add React button component and use for settings button - #1972
Conversation
…sic settings button
|
@jamesmisson is attempting to deploy a commit to the Universal Viewer Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
demiankatz
left a comment
There was a problem hiding this comment.
Thanks, @jamesmisson, this is off to a great start!
How do you plan for the new button components to interact with the mobile view? Since the settings button currently disappears in mobile, I wasn't able to see how it might behave. Perhaps it's worth doing the remaining buttons to get a more complete test case.
See below for a couple of additional comments:
LanieOkorodudu
left a comment
There was a problem hiding this comment.
Thanks so much for all your work on this, @jamesmisson. Really appreciate it.
Just a couple of small things I noticed while testing. The Settings button looks a little smaller in this PR compared to Dev. I noticed the SVG path size is around 14.9 × 15. Would it be possible to make it slightly bigger, like in Dev? But if that's the standard size, then no worries at all.
I also noticed that the focus indicators for Zoom In, Zoom Out, Rotate and Adjust look a little different. I'm guessing these are still being worked on as part of this PR?
|
Thank you both for taking a look. @demiankatz in the interests of getting this PR done before the end of the sprint, I've kicked those cans down the road. The mobile footer creates the buttons independently from the desktop header so I've opened a ticket to replace those much like the other components - #1974 . I've changed the tooltip styling but this is just a placeholder for now, I think we can work out a nicer overall design for button highlighting (#1975) @LanieOkorodudu the settings icon is deliberately a little smaller, I hope this will look more coherent when the other new icon designs are in place, but we can always resize it if not. |
demiankatz
left a comment
There was a problem hiding this comment.
Thanks, @jamesmisson -- the tooltip definitely looks better for now, and I'm happy to defer further changes to the issues you've created.
Pull request description
Summary of changes
This adds a new React base component
Buttonintended to be used for all the buttons in UV. It also makes a new container React component for the buttons in the top right options (HeaderPanelRightOptions), and implements the new component for the settings button to test it. The PR also contains the beginnings of an SVG Icons file, currently only containing the settings icon.The button component handles the tooltip, getting the label from the relevant UV module content, passed to the button component as a prop. The placement of the tooltip is determined by the
tooltipPlacementprop (bottom, top, left, or right; default is bottom). If the tooltip risks going off the edge of UV (e.g. with this settings example, in the top right corner), thetooltipAlignmentprop can be set to start, center, or end (default is center) to keep it aligned with either side of the button itself.The button and the tooltip are built to conform to WCAG 2.2 specifications:
1.4.13 Content on Hover or Focus (AA)
4.1.2 Name, Role, Value (A)
<button type="button">with anaria-label.aria-hidden, so screen readers don't read the label twice.2.5.3 Label in Name (A)
2.1.1 Keyboard (A)
:focus-visible) as well as on hover.2.4.7 Focus Visible (AA)
:focus-visible.1.1.1 Non-text Content (A)
aria-hiddenandfocusable="false". The button'saria-labelprovides the text alternative.2.3.3 Animation from Interactions (AAA)
prefers-reduced-motion: reduce, the slide in is removed.Tooltips should only open on hover on devices that actually support hover (
@media (hover: hover)).In this PR, I've put the React root inside the
rightOptionsdiv to maintain keyboard navigation, but ultimately therightOptionsdiv will become the root for theHeaderPanelRightOptionscomponent and the other buttons converted to React within that, for #1956Related issues
UI sprint issue: #1805
Contributor checklist
Accessibility & internationalisation
Compatibility & interoperability
Code quality & testing
Configuration & documentation
No new config added but I think we ultimately need a config option for tooltipsEnabled
Additional notes for reviewers:
As noted above, I think we need a config option for
tooltipsEnabled. Happy to add this to this PR, or save it for a separate one in the UI sprint.I haven't been able to test this on a non-mobile touch screen.