generated from allen-cell-animated/github-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
keyboard navigation: feature/focus states (#589)
* prototype focus styling for header elements * use custom dropdown wrapper to keep stylesheets dry * focus style on AICS logo button * updated focus and hover stylings for header buttons and dropdown items * remove commented code * remove unused imports * remove narrow property on CustomDropdown to style with fit-content * use focus-visible selector for keyboard navigation styling in stead of :focus * unused import
- Loading branch information
Showing
11 changed files
with
169 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React, { ReactNode } from "react"; | ||
import { Dropdown, DropDownProps, MenuProps } from "antd"; | ||
import { ButtonClass } from "../../constants/interfaces"; | ||
import NavButton from "../NavButton"; | ||
|
||
import styles from "./style.css"; | ||
|
||
interface CustomDropdownProps { | ||
items: MenuProps["items"]; | ||
titleText: string; | ||
icon: ReactNode; | ||
buttonType: ButtonClass; | ||
placement?: DropDownProps["placement"]; | ||
disabled?: boolean; | ||
} | ||
|
||
const CustomDropdown: React.FC<CustomDropdownProps> = ({ | ||
items, | ||
titleText, | ||
icon, | ||
buttonType, | ||
placement, | ||
disabled, | ||
}) => { | ||
return ( | ||
<Dropdown | ||
menu={{ items, theme: "dark", className: styles.menu }} | ||
placement={placement} | ||
disabled={disabled} | ||
> | ||
<NavButton | ||
titleText={titleText} | ||
icon={icon} | ||
buttonType={buttonType} | ||
/> | ||
</Dropdown> | ||
); | ||
}; | ||
|
||
export default CustomDropdown; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
.menu { | ||
width: fit-content; | ||
background-color: var(--dark-theme-dropdown-menu-bg); | ||
border-radius: 3px; | ||
padding: 8px; | ||
} | ||
|
||
.menu svg { | ||
fill: var(--dark-theme-menu-text-color); | ||
} | ||
|
||
.menu :global(.ant-dropdown-menu-item), | ||
.menu :global(.ant-dropdown-menu-submenu) { | ||
border: 2px solid var(--dark-theme-dropdown-menu-item-bg); | ||
border-radius: 4px; | ||
height: 32px; | ||
} | ||
|
||
.menu :global(.ant-dropdown-menu-item) :global(.ant-btn) { | ||
color: var(--dark-theme-dropdown-menu-item-color); | ||
padding: 0px; | ||
} | ||
|
||
.menu :global(.ant-dropdown-menu-item):hover, | ||
.menu :global(.ant-dropdown-menu-submenu):hover { | ||
background-color: var(--dark-theme-dropdown-menu-item-hover-bg); | ||
} | ||
|
||
.menu :global(.ant-dropdown-menu-item):hover *, | ||
.menu :global(.ant-dropdown-menu-submenu):hover * { | ||
color: var(--dark-theme-dropdown-menu-item-hover-color); | ||
fill: var(--dark-theme-dropdown-menu-item-hover-color); | ||
} | ||
|
||
.menu :global(.ant-dropdown-menu-item):focus-within, | ||
.menu :global(.ant-dropdown-menu-submenu):focus-within { | ||
z-index: 1000; | ||
background-color: var(--dark-theme-dropdown-menu-item-focus-bg); | ||
outline: 1px solid var(--dark-theme-dropdown-menu-item-focus-outline); | ||
} | ||
|
||
.menu :global(.ant-dropdown-menu-item) *:focus-visible { | ||
color: var(--dark-theme-dropdown-menu-item-focus-color); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.