Skip to content

Commit d4fa2fd

Browse files
committed
Update/use defaultFocusOutline
1 parent 7cc31a0 commit d4fa2fd

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

src/app/components/Dropdown.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { FormattedMessage, useIntl } from 'react-intl';
88
import styled, { css, keyframes } from 'styled-components/macro';
99
import { useFocusLost, useTrapTabNavigation } from '../reactUtils';
1010
import { useOnEsc } from '../reactUtils';
11-
import theme from '../theme';
11+
import theme, { defaultFocusOutline } from '../theme';
1212
import { preventDefault } from '../utils';
1313
import { textStyle } from './Typography/base';
1414

@@ -210,8 +210,7 @@ export const DropdownList = styled(TrappingDropdownList)`
210210
&:hover,
211211
&:focus {
212212
background: ${theme.color.neutral.formBorder};
213-
outline: 0.2rem auto Highlight;
214-
outline: 0.2rem inset -webkit-focus-ring-color;
213+
${defaultFocusOutline}
215214
}
216215
}
217216
`;

src/app/content/highlights/components/ColorPicker.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { highlightStyles } from '../../constants';
77
import { cardPadding } from '../constants';
88
import ColorIndicator from './ColorIndicator';
99
import { HTMLDivElement, HTMLInputElement } from '@openstax/types/lib.dom';
10+
import { defaultFocusOutline } from '../../../theme';
1011

1112
interface SingleSelectProps {
1213
color?: HighlightColorEnum;
@@ -63,8 +64,7 @@ const ColorButton = styled(({className, size, style, ...props}: ColorButtonProps
6364
}
6465
6566
:focus-within {
66-
outline: 0.2rem auto Highlight;
67-
outline: 0.2rem inset -webkit-focus-ring-color;
67+
${defaultFocusOutline}
6868
}
6969
`;
7070

src/app/theme.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ const textColors = {
3030

3131
// Browser default outline for focus items per
3232
// tslint:disable-next-line:max-line-length
33-
// https://stackoverflow.com/questions/20609485/what-is-the-default-style-of-the-blue-focus-outline-in-chrome/38498539#38498539
33+
// https://css-tricks.com/copy-the-browsers-native-focus-styles/
3434
export const defaultFocusOutline = `
35-
outline: 0.1rem dotted #212121;
36-
outline: 0.5rem auto -webkit-focus-ring-color;
35+
outline: 0.2rem auto Highlight;
36+
outline: 0.2rem inset -webkit-focus-ring-color;
3737
`;
3838

3939
const greyColors = {

0 commit comments

Comments
 (0)