Skip to content

Commit

Permalink
Revert "Focus on DisplayNote goes to the menu button"
Browse files Browse the repository at this point in the history
This reverts commit 7e8a6d4.
  • Loading branch information
RoyEJohnson committed Oct 2, 2024
1 parent 7e8a6d4 commit dd06dbe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 35 deletions.
13 changes: 3 additions & 10 deletions src/app/content/highlights/components/DisplayNote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Dropdown, { DropdownItem, DropdownList } from '../../../components/Dropdo
import Times from '../../../components/Times';
import { textStyle } from '../../../components/Typography/base';
import { useDebouncedWindowSize, useFocusElement } from '../../../reactUtils';
import theme, { defaultFocusOutline } from '../../../theme';
import theme from '../../../theme';
import { mergeRefs } from '../../../utils';
import { highlightStyles } from '../../constants';
import { query } from '../../search/selectors';
Expand Down Expand Up @@ -92,16 +92,13 @@ const DisplayNote = React.forwardRef<HTMLElement, DisplayNoteProps>((
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [element, confirmationRef, confirmingDelete, textToggle, width, isTocOpen, searchQuery]);

const buttonPseudoRef = {
current: element.current?.querySelector('button') ?? null,
};

useFocusElement(buttonPseudoRef, shouldFocusCard);
useFocusElement(element, shouldFocusCard);

return (
<div
className={className}
ref={mergeRefs(ref, element)}
tabIndex={-1}
data-highlight-card
role='dialog'
aria-label={formatMessage({id: 'i18n:highlighter:display-note:label'})}
Expand Down Expand Up @@ -167,10 +164,6 @@ export default styled(DisplayNote)`
:focus-within ${MenuIcon} {
color: ${theme.color.primary.gray.base};
}
> button:focus {
${defaultFocusOutline}
}
}
${theme.breakpoints.touchDeviceQuery(css`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,6 @@ exports[`DisplayNote matches snapshot 1`] = `
color: #5e6062;
}
.c0 .c2 > button:focus {
outline: 0.2rem auto Highlight;
outline: 0.2rem auto -webkit-focus-ring-color;
}
@media screen and (max-width:75em) {
.c0 {
margin-left: 8rem;
Expand All @@ -125,6 +120,7 @@ exports[`DisplayNote matches snapshot 1`] = `
className="c0"
data-highlight-card={true}
role="dialog"
tabIndex={-1}
>
<div
className="c1 c2 c3"
Expand Down Expand Up @@ -279,11 +275,6 @@ exports[`DisplayNote matches snapshot when focused 1`] = `
color: #5e6062;
}
.c12 .c2 > button:focus {
outline: 0.2rem auto Highlight;
outline: 0.2rem auto -webkit-focus-ring-color;
}
.c0 {
width: 20rem;
overflow: visible;
Expand Down Expand Up @@ -318,11 +309,6 @@ exports[`DisplayNote matches snapshot when focused 1`] = `
color: #5e6062;
}
.c0 .c2 > button:focus {
outline: 0.2rem auto Highlight;
outline: 0.2rem auto -webkit-focus-ring-color;
}
@media screen and (max-width:75em) {
.c0 {
margin-left: 8rem;
Expand All @@ -340,6 +326,7 @@ exports[`DisplayNote matches snapshot when focused 1`] = `
className="c0"
data-highlight-card={true}
role="dialog"
tabIndex={-1}
>
<div
className="c1 c2 c3"
Expand Down Expand Up @@ -544,11 +531,6 @@ exports[`DisplayNote matches snapshot when focused with opened dropdown 1`] = `
color: #5e6062;
}
.c14 .c2 > button:focus {
outline: 0.2rem auto Highlight;
outline: 0.2rem auto -webkit-focus-ring-color;
}
.c0 {
width: 20rem;
overflow: visible;
Expand Down Expand Up @@ -583,11 +565,6 @@ exports[`DisplayNote matches snapshot when focused with opened dropdown 1`] = `
color: #5e6062;
}
.c0 .c2 > button:focus {
outline: 0.2rem auto Highlight;
outline: 0.2rem auto -webkit-focus-ring-color;
}
@media screen and (max-width:75em) {
.c0 {
margin-left: 8rem;
Expand All @@ -605,6 +582,7 @@ exports[`DisplayNote matches snapshot when focused with opened dropdown 1`] = `
className="c0"
data-highlight-card={true}
role="dialog"
tabIndex={-1}
>
<div
className="c1 c2 c3"
Expand Down

0 comments on commit dd06dbe

Please sign in to comment.