Skip to content

Commit

Permalink
Set accessibility attributes when children change & changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewMusgrave committed Jan 6, 2020
1 parent 6b6a332 commit caece76
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
1 change: 1 addition & 0 deletions UNRELEASED.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@

- Converted `BulkActionButton` into a functional component ([#2542](https://github.com/Shopify/polaris-react/pull/2542))
- Converted `Focus` into a functional component ([#2540](https://github.com/Shopify/polaris-react/pull/2540))
- Converted `Tooltip` into a functional component ([#2543](https://github.com/Shopify/polaris-react/pull/2543))

### Deprecations
9 changes: 2 additions & 7 deletions src/components/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ export function Tooltip({
const activatorContainer = useRef<HTMLElement>(null);
const mouseEntered = useRef(false);

// Check this impl
const setAccessibilityAttributes = useCallback(() => {
useEffect(() => {
if (activatorContainer == null) {
return;
}
Expand All @@ -62,11 +61,7 @@ export function Tooltip({

accessibilityNode.tabIndex = 0;
accessibilityNode.setAttribute('aria-describedby', id);
}, [id]);

useEffect(() => {
setAccessibilityAttributes();
}, [setAccessibilityAttributes]);
}, [id, children]);

const portal = activatorNode ? (
<Portal idPrefix="tooltip">
Expand Down

0 comments on commit caece76

Please sign in to comment.