Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keyboard focus order is not proper on "Description" and "Create github pull request" screen: A11y_Visual Studio Code Web Extensions_Github Pull request_Description_Keyboard #6578

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
);