From b9adf1d5c78ef050dad8ed121d3a67b3f9feb824 Mon Sep 17 00:00:00 2001 From: Taylor Jones Date: Tue, 2 Mar 2021 14:34:05 -0600 Subject: [PATCH] fix(HeaderGlobalAction): provide visual text for link via title attribute (#7736) * fix(uishell): use aria-label text as title in header global action * chore: update headerglobalaction snapshot * fix(uishell): use + ); }); @@ -82,6 +88,12 @@ HeaderGlobalAction.propTypes = { * button fires it's onclick event */ onClick: PropTypes.func, + + /** + * Specify the alignment of the tooltip to the icon-only button. + * Can be one of: start, center, or end. + */ + tooltipAlignment: PropTypes.oneOf(['start', 'center', 'end']), }; HeaderGlobalAction.displayName = 'HeaderGlobalAction'; diff --git a/packages/react/src/components/UIShell/UIShell-story.js b/packages/react/src/components/UIShell/UIShell-story.js index aa130432fbc8..2e66ce7984ea 100644 --- a/packages/react/src/components/UIShell/UIShell-story.js +++ b/packages/react/src/components/UIShell/UIShell-story.js @@ -254,7 +254,8 @@ export const HeaderBaseWActions = withReadme(readme, () => ( + onClick={action('app-switcher click')} + tooltipAlignment="end"> @@ -283,7 +284,8 @@ export const HeaderBaseWSkipToContent = withReadme(readme, () => ( + onClick={action('app-switcher click')} + tooltipAlignment="end"> @@ -330,7 +332,8 @@ export const HeaderBaseWNavigationAndActions = withReadme(readme, () => ( + onClick={action('app-switcher click')} + tooltipAlignment="end"> @@ -396,7 +399,8 @@ export const HeaderBaseWNavigationActionsAndSideNav = withReadme(readme, () => ( + onClick={action('app-switcher click')} + tooltipAlignment="end"> @@ -552,7 +556,8 @@ export const HeaderBaseWActionsAndRightPanel = withReadme(readme, () => ( + onClick={action('app-switcher click')} + tooltipAlignment="end"> @@ -580,7 +585,8 @@ export const HeaderBaseWActionsAndSwitcher = withReadme(readme, () => ( + onClick={action('app-switcher click')} + tooltipAlignment="end"> @@ -828,7 +834,8 @@ export const SideNavRailWHeader = withReadme(readme, () => ( + onClick={action('app-switcher click')} + tooltipAlignment="end"> diff --git a/packages/react/src/components/UIShell/__tests__/__snapshots__/HeaderGlobalAction-test.js.snap b/packages/react/src/components/UIShell/__tests__/__snapshots__/HeaderGlobalAction-test.js.snap index 121ec020c19b..27883cdcea1b 100644 --- a/packages/react/src/components/UIShell/__tests__/__snapshots__/HeaderGlobalAction-test.js.snap +++ b/packages/react/src/components/UIShell/__tests__/__snapshots__/HeaderGlobalAction-test.js.snap @@ -7,37 +7,60 @@ exports[`HeaderGlobalAction should render 1`] = ` isActive={false} onClick={[MockFunction]} > - + + + + + + + `;