-
Notifications
You must be signed in to change notification settings - Fork 14
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
feat(PPDSC-2118): tooltip pointer #217
Conversation
- <p> cannot contain the <div> required for the pointer
- add optional pointer element too tooltip - add default offset to tooltip with ability to override
You can preview these changes on: |
- pointer and panel should both inherit background colour from tooltip style preset - panel should have additional style preset to manage border radius and text colour
- Move inset styling to styled component - Update inset styling based on offset passed - Handle non-px and MQ values for offset (distance) - Update tests
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.
just 1 small comment, well done 👏
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.
Could we add the aria-hidden
attribute to tooltip like https://www.w3.org/WAI/WCAG21/Techniques/aria/ARIA1? This is something I missed in the last pr. When scanning through with screenreader, the content of the tooltip is read twice. By adding this, we can avoid redundancy. Happy to have a chat about this.
- To prevent screen readers reading tooltip content twice (once when focusing on the context element and once when scanning).
* feat(PPDSC-2118): change tooltip element to div - <p> cannot contain the <div> required for the pointer * feat(PPDSC-2118): add pointer to tooltip - add optional pointer element too tooltip - add default offset to tooltip with ability to override * feat(PPDSC-2118): make sure pointer id is globally unique * feat(PPDSC-2118): add test case to make meet coverage req * feat(PPDSC-2118): update default tooltip trigger to include focus * feat(PPDSC-2118): split tooltip panel style preset - pointer and panel should both inherit background colour from tooltip style preset - panel should have additional style preset to manage border radius and text colour * feat(PPDSC-2118): add no pointer scenario * feat(PPDSC-2118): update tests to assert on tooltip position * feat(PPDSC-2118): separate tooltip panel element * feat(PPDSC-2118): apply tooltip offset in styled component - Move inset styling to styled component - Update inset styling based on offset passed - Handle non-px and MQ values for offset (distance) - Update tests * feat(PPDSC-2118): nest tooltip panel and pointer defaults * feat(PPDSC-2118): set background-color separately for panel and pointer * feat(PPDSC-2118): update theme snapshots * feat(PPDSC-2118): stop x and y coords being passed to html * feat(PPDSC-2118): rename tooltip title prop to content * feat(PPDSC-2118): change showPointer to hidePointer * feat(PPDSC-2118): add tests for offset logic utils * feat(PPDSC-2118): add aria-hidden to tooltip - To prevent screen readers reading tooltip content twice (once when focusing on the context element and once when scanning).
PPDSC-2118
What
I have done:
I have tested manually:
Differences to ticket:
distance
as prop and an override. I only included it as an override as this seems more appropriate.Other notes:
<div>
rather than a<p>
. This is because the pointer<div>
needs to be a child of the tooltip so that it can be positioned correctly. But<div>
cannot appear as a descendant of<p>
(or we get avalidateDOMNesting
console error).