A11y: Add focus styles to dashboard toolbar links (#35895)

This commit is contained in:
kay delaney
2021-06-23 12:03:44 +01:00
committed by GitHub
parent 83860bdcc3
commit f5bd325354
5 changed files with 76 additions and 53 deletions

View File

@@ -7,7 +7,7 @@ import { playlistSrv } from 'app/features/playlist/PlaylistSrv';
import { DashNavButton } from './DashNavButton';
import { DashNavTimeControls } from './DashNavTimeControls';
import { ButtonGroup, ModalsController, ToolbarButton, PageToolbar } from '@grafana/ui';
import { textUtil } from '@grafana/data';
import { locationUtil, textUtil } from '@grafana/data';
// State
import { updateTimeZoneForSession } from 'app/features/profile/state/reducers';
// Types
@@ -57,10 +57,6 @@ class DashNav extends PureComponent<Props> {
super(props);
}
onFolderNameClick = () => {
locationService.partial({ search: 'open', folder: 'current' });
};
onClose = () => {
locationService.partial({ viewPanel: null });
};
@@ -96,10 +92,6 @@ class DashNav extends PureComponent<Props> {
this.forceUpdate();
};
onDashboardNameClick = () => {
locationService.partial({ search: 'open' });
};
addCustomContent(actions: DashNavButtonModel[], buttons: ReactNode[]) {
actions.map((action, index) => {
const Component = action.component;
@@ -250,13 +242,16 @@ class DashNav extends PureComponent<Props> {
const { isFullscreen, title, folderTitle } = this.props;
const onGoBack = isFullscreen ? this.onClose : undefined;
const titleHref = locationUtil.updateSearchParams(window.location.href, '?search=open');
const parentHref = locationUtil.updateSearchParams(window.location.href, '?search=open&folder=current');
return (
<PageToolbar
pageIcon={isFullscreen ? undefined : 'apps'}
title={title}
parent={folderTitle}
onClickTitle={this.onDashboardNameClick}
onClickParent={this.onFolderNameClick}
titleHref={titleHref}
parentHref={parentHref}
onGoBack={onGoBack}
leftItems={this.renderLeftActionsButton()}
>