Skip to content

Commit

Permalink
feat: add autoFocus of lunatic
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentC35 committed Nov 2, 2023
1 parent bd9a73c commit e9e0a53
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const ComponentDisplayer = ({ components, readonly, pageTag }) => {
return (
<>
<lunatic.LunaticComponents
autoFocusKey={pageTag}
components={components}
componentProps={() => ({
filterDescription: false,
Expand All @@ -19,7 +20,7 @@ export const ComponentDisplayer = ({ components, readonly, pageTag }) => {
{children}
</div>
)}
/>{' '}
/>
</>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,9 @@ export const useStyles = makeStyles(() => ({
display: 'flex',
flexDirection: 'row',
height: '100%',
// fix css with a new <div/> elements needed for autoFocus
'& > div': {
display: 'contents',
},
},
}));
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ import {
import React, { useCallback, useRef, useState } from 'react';
import { dependencies, version } from '../../../../package.json';

import { IconButton } from '@material-ui/core';
import { Apps } from '@material-ui/icons';
import { ButtonItemMenu } from 'components/designSystem';
import D from 'i18n';
import { IconButton } from '@material-ui/core';
import KeyboardEventHandler from 'react-keyboard-event-handler';
import isEqual from 'lodash.isequal';
import PropTypes from 'prop-types';
import KeyboardEventHandler from 'react-keyboard-event-handler';
import { useStyles } from './component.style';
import SequenceNavigation from './sequenceNavigation';
import StopNavigation from './stopNavigation';
import SubsequenceNavigation from './subSequenceNavigation';
import isEqual from 'lodash.isequal';
import { useStyles } from './component.style';

const Navigation = ({
className,
Expand Down Expand Up @@ -131,8 +131,6 @@ const Navigation = ({
<>
<IconButton
ref={listRefs[0]}
// eslint-disable-next-line jsx-a11y/no-autofocus
autoFocus
title={D.mainMenu}
className={classes.menuIcon}
onClick={openCloseMenu}
Expand Down

0 comments on commit e9e0a53

Please sign in to comment.