Add FocusScope to PanelEditor when open in the Dashboard Page so that a11y focus never catches invisible content. (#54400) (#54430)

(cherry picked from commit ef32050508)
This commit is contained in:
Polina Boneva
2022-08-30 06:04:41 -04:00
committed by GitHub
parent ecf7cae554
commit 0a4d2bbe3d
@@ -1,3 +1,4 @@
import { FocusScope } from '@react-aria/focus';
import classnames from 'classnames';
import React, { PureComponent } from 'react';
import { connect, ConnectedProps } from 'react-redux';
@@ -406,7 +407,13 @@ export class UnthemedDashboardPage extends PureComponent<Props, State> {
<DashboardGrid dashboard={dashboard} viewPanel={viewPanel} editPanel={editPanel} />
{inspectPanel && <PanelInspector dashboard={dashboard} panel={inspectPanel} />}
{editPanel && <PanelEditor dashboard={dashboard} sourcePanel={editPanel} tab={this.props.queryParams.tab} />}
{editPanel && (
<FocusScope contain autoFocus restoreFocus>
<section>
<PanelEditor dashboard={dashboard} sourcePanel={editPanel} tab={this.props.queryParams.tab} />
</section>
</FocusScope>
)}
{queryParams.editview && <DashboardSettings dashboard={dashboard} editview={queryParams.editview} />}
</Page>
);