Merge branch 'focus-styles' into 'develop'
Focus styles, keyboard navigation improvements See merge request soapbox-pub/soapbox!1933
This commit is contained in:
commit
6456737d8a
5 changed files with 18 additions and 6 deletions
|
@ -21,9 +21,15 @@ const ListItem: React.FC<IListItem> = ({ label, hint, children, onClick }) => {
|
||||||
const id = uuidv4();
|
const id = uuidv4();
|
||||||
const domId = `list-group-${id}`;
|
const domId = `list-group-${id}`;
|
||||||
|
|
||||||
|
const onKeyDown = (e: React.KeyboardEvent) => {
|
||||||
|
if (e.key === 'Enter') {
|
||||||
|
onClick!();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const Comp = onClick ? 'a' : 'div';
|
const Comp = onClick ? 'a' : 'div';
|
||||||
const LabelComp = onClick ? 'span' : 'label';
|
const LabelComp = onClick ? 'span' : 'label';
|
||||||
const linkProps = onClick ? { onClick } : {};
|
const linkProps = onClick ? { onClick, onKeyDown, tabIndex: 0, role: 'link' } : {};
|
||||||
|
|
||||||
const renderChildren = React.useCallback(() => {
|
const renderChildren = React.useCallback(() => {
|
||||||
return React.Children.map(children, (child) => {
|
return React.Children.map(children, (child) => {
|
||||||
|
|
|
@ -134,9 +134,11 @@ const SidebarMenu: React.FC = (): JSX.Element | null => {
|
||||||
if (!account) return null;
|
if (!account) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classNames('sidebar-menu__root', {
|
<div
|
||||||
'sidebar-menu__root--visible': sidebarOpen,
|
className={classNames('sidebar-menu__root', {
|
||||||
})}
|
'sidebar-menu__root--visible': sidebarOpen,
|
||||||
|
})}
|
||||||
|
aria-expanded={sidebarOpen}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className={classNames({
|
className={classNames({
|
||||||
|
|
|
@ -66,7 +66,7 @@ const StatusReplyMentions: React.FC<IStatusReplyMentions> = ({ status, hoverable
|
||||||
|
|
||||||
if (to.size > 2) {
|
if (to.size > 2) {
|
||||||
accounts.push(
|
accounts.push(
|
||||||
<span key='more' className='hover:underline cursor-pointer' role='presentation' onClick={handleOpenMentionsModal}>
|
<span key='more' className='hover:underline cursor-pointer' role='button' onClick={handleOpenMentionsModal} tabIndex={0}>
|
||||||
<FormattedMessage id='reply_mentions.more' defaultMessage='{count} more' values={{ count: to.size - 2 }} />
|
<FormattedMessage id='reply_mentions.more' defaultMessage='{count} more' values={{ count: to.size - 2 }} />
|
||||||
</span>,
|
</span>,
|
||||||
);
|
);
|
||||||
|
|
|
@ -53,7 +53,7 @@ const Search: React.FC = () => {
|
||||||
placeholder={intl.formatMessage(messages.search)}
|
placeholder={intl.formatMessage(messages.search)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div role='button' tabIndex={0} className='search__icon' onClick={handleClear}>
|
<div role='button' tabIndex={hasValue ? 0 : -1} className='search__icon' onClick={handleClear}>
|
||||||
<Icon src={require('@tabler/icons/backspace.svg')} aria-label={intl.formatMessage(messages.search)} className={classNames('svg-icon--backspace', { active: hasValue })} />
|
<Icon src={require('@tabler/icons/backspace.svg')} aria-label={intl.formatMessage(messages.search)} className={classNames('svg-icon--backspace', { active: hasValue })} />
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
|
|
|
@ -8,6 +8,10 @@
|
||||||
user-select: none;
|
user-select: none;
|
||||||
-webkit-tap-highlight-color: rgba($base-overlay-background, 0);
|
-webkit-tap-highlight-color: rgba($base-overlay-background, 0);
|
||||||
-webkit-tap-highlight-color: transparent;
|
-webkit-tap-highlight-color: transparent;
|
||||||
|
|
||||||
|
&:focus-within .react-toggle-track {
|
||||||
|
@apply ring-2 ring-offset-2 ring-primary-500;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.react-toggle-screenreader-only {
|
.react-toggle-screenreader-only {
|
||||||
|
|
Loading…
Reference in a new issue