Skip to content

Commit

Permalink
Fix / CLOUD-25858 / header menu button aria-label (#14)
Browse files Browse the repository at this point in the history
* update ui-theme to v0.4.2

* fix: aria-label for HeaderMenuButton
  • Loading branch information
oli-hivemq authored Sep 5, 2024
1 parent a573e2d commit 6188b85
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 21 deletions.
11 changes: 3 additions & 8 deletions .storybook/chakraTheme.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
// Theming with Chakra UI is based on the Styled System Theme Specification
// Extend the theme to include custom colors, fonts, etc
import { extendTheme } from "@chakra-ui/react";
import { colors, components, fonts, styles } from "@hivemq/ui-theme";
import { extendTheme } from "@chakra-ui/react"
import theme from "@hivemq/ui-theme"

export const chakraTheme = extendTheme({
styles,
fonts,
colors,
components,
});
export const chakraTheme = extendTheme(theme)
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@emotion/styled": "^11.12.0",
"@fontsource/raleway": "^5.0.19",
"@fontsource/roboto": "^5.0.13",
"@hivemq/ui-theme": "^0.2.1",
"@hivemq/ui-theme": "^0.4.2",
"@radix-ui/react-slot": "^1.1.0",
"@storybook/addon-a11y": "^8.2.6",
"@storybook/addon-essentials": "^8.2.4",
Expand Down Expand Up @@ -87,7 +87,7 @@
"@chakra-ui/styled-system": "^2.9.2",
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@hivemq/ui-theme": "^0.5.0",
"@hivemq/ui-theme": "^0.4.2",
"react": "^18.2.0",
"react-dom": "^18.2.0"
}
Expand Down
9 changes: 5 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/docs/cookbook/FullDemo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export function FullDemo() {
))}
<Box flexGrow="2" textAlign="right">
<Header.Menu overlayId="profile">
<Header.MenuButton icon={UserIcon} ariaLabel="Profile" />
<Header.MenuButton icon={UserIcon} aria-label="Profile" />
<Header.MenuContent>
<Header.MenuContentDetails textAlign="center">
<b>Hello Batman 👋</b>
Expand All @@ -135,7 +135,7 @@ export function FullDemo() {
</Header.MenuContent>
</Header.Menu>
<Header.Menu overlayId="support">
<Header.MenuButton icon={InfoIcon} ariaLabel="Support" />
<Header.MenuButton icon={InfoIcon} aria-label="Support" />
<Header.MenuContent>
<Header.MenuContentDetails>Hi, How can we help you? 💁‍♀️</Header.MenuContentDetails>
<Header.MenuContentItem>Test</Header.MenuContentItem>
Expand Down
4 changes: 2 additions & 2 deletions src/modules/Header/Header.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const WithSidebarNavigationToggle: Story = {
<Header.Divider />
<Box alignSelf="end">
<Header.Menu overlayId="test">
<Header.MenuButton icon={UserIcon} ariaLabel="Profile" />
<Header.MenuButton icon={UserIcon} aria-label="Profile" />
<Header.MenuContent>
<Header.MenuContentDetails textAlign="center">
<b>Hello Batman 👋</b>
Expand All @@ -65,7 +65,7 @@ export const WithSidebarNavigationToggle: Story = {
</Header.MenuContent>
</Header.Menu>
<Header.Menu overlayId="other">
<Header.MenuButton icon={InfoIcon} ariaLabel="Support" />
<Header.MenuButton icon={InfoIcon} aria-label="Support" />
<Header.MenuContent>
<Header.MenuContentDetails>Hi, How can we help you? 💁‍♀️</Header.MenuContentDetails>
<Header.MenuContentItem>Test</Header.MenuContentItem>
Expand Down
5 changes: 2 additions & 3 deletions src/modules/Header/HeaderMenuButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ import { type LucideIcon, XIcon } from 'lucide-react'
export type HeaderMenuButtonProps = {
icon: LucideIcon
closeIcon?: LucideIcon
ariaLabel: string
'aria-label': string
}

const OPEN_MARGIN_IN_PIXEL = 4
const BORDER_WIDTH_IN_PIXEL = 2
const MAX_CONTAINER_SIZE_IN_PIXEL = 56

export const HeaderMenuButton = forwardRef<HeaderMenuButtonProps, 'button'>((props, ref) => {
const { ariaLabel, as, icon, closeIcon = XIcon } = props
const { 'aria-label': _ariaLabel, as, icon, closeIcon = XIcon } = props
const { isOpen } = useMenuContext()

const containerSize = isOpen
Expand All @@ -36,7 +36,6 @@ export const HeaderMenuButton = forwardRef<HeaderMenuButtonProps, 'button'>((pro

return (
<MenuButton
aria-label={ariaLabel}
_hover={{
backgroundColor: 'surface.800',
}}
Expand Down

0 comments on commit 6188b85

Please sign in to comment.