Skip to content

Commit

Permalink
Keyboard focus order is not proper on "Description" and "Create githu…
Browse files Browse the repository at this point in the history
…b pull request" screen: A11y_Visual Studio Code Web Extensions_Github Pull request_Description_Keyboard

Fixes #6451
  • Loading branch information
alexr00 committed Dec 20, 2024
1 parent a7db818 commit 5042fbb
Showing 1 changed file with 43 additions and 11 deletions.
54 changes: 43 additions & 11 deletions webviews/editorWebview/overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,53 @@ import { StatusChecksSection } from '../components/merge';
import Sidebar from '../components/sidebar';
import { Timeline } from '../components/timeline';

export const Overview = (pr: PullRequest) => (
<>
const useMediaQuery = (query: string) => {
const [matches, setMatches] = React.useState(window.matchMedia(query).matches);

React.useEffect(() => {
const mediaQueryList = window.matchMedia(query);
const documentChangeHandler = () => setMatches(mediaQueryList.matches);

mediaQueryList.addEventListener('change', documentChangeHandler);

return () => {
mediaQueryList.removeEventListener('change', documentChangeHandler);
};
}, [query]);

return matches;
};

export const Overview = (pr: PullRequest) => {
const isSingleColumnLayout = useMediaQuery('(max-width: 925px)');

return <>
<div id="title" className="title">
<div className="details">
<Header {...pr} />
</div>
</div>
<Sidebar {...pr} />
<div id="main">
<div id="description">
<CommentView isPRDescription comment={pr} />
</div>
<Timeline events={pr.events} />
<StatusChecksSection pr={pr} isSimple={false} />
<AddComment {...pr} />
{isSingleColumnLayout ?
<>
<Sidebar {...pr} />
<Main {...pr} />
</>
:
<>
<Main {...pr} />
<Sidebar {...pr} />
</>
}
</>;
};

const Main = (pr: PullRequest) => (
<div id="main">
<div id="description">
<CommentView isPRDescription comment={pr} />
</div>
</>
<Timeline events={pr.events} />
<StatusChecksSection pr={pr} isSimple={false} />
<AddComment {...pr} />
</div>
);

0 comments on commit 5042fbb

Please sign in to comment.