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

Accessibility A #3688

Merged
merged 23 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
863edd8
Publish SNAPSHOT from the epic branch
alansemenov Jun 25, 2024
3c89623
Enable setting `lang` and `role` attributes #3615 #3619
alansemenov Jun 25, 2024
3ad4ee2
Refactor AppIcon & TabbedAppBar #3625
alansemenov Jul 1, 2024
702d934
Accessibility: Toolbar #3626
alansemenov Jul 1, 2024
30aaa9a
Implement an interface with WCAG properties #3641
alansemenov Jul 5, 2024
e3eeaa0
Accessibility: Toolbar #3626
alansemenov Jul 5, 2024
36f1dea
Accessibility: AppBar #3638
alansemenov Jul 5, 2024
2c09db8
Support aria-haspopup attribute on Element #3650
alansemenov Jul 10, 2024
eb9e0c6
Accessibility: Toolbar navigation #3642
alansemenov Jul 12, 2024
e08b220
Fixed misc issues
alansemenov Aug 12, 2024
f1c74ec
Fixed Checkbox not getting checked
alansemenov Aug 12, 2024
6e802da
Fixed focus on modal dialog buttons
alansemenov Aug 12, 2024
200751e
Accessibility: Toolbar navigation #3642
alansemenov Aug 15, 2024
90380e7
Refactor ActionButton and MenuButton #3677
alansemenov Aug 22, 2024
fcc0897
Refactor ActionButton and MenuButton #3677
alansemenov Aug 26, 2024
6032c45
Accessibility: Input highlighting #3687
alansemenov Aug 28, 2024
45655b9
Use display: flex for TabMenu
alansemenov Aug 29, 2024
93d8578
Don't try to reapply focus to the last focused element if there was none
alansemenov Aug 29, 2024
a449929
Refactor ActionButton and MenuButton #3677
alansemenov Aug 30, 2024
e7e8077
Refactor ActionButton and MenuButton #3677
alansemenov Aug 30, 2024
5856bc0
Made buttons trigger action on Space
alansemenov Sep 3, 2024
c70e426
Changes to comply with ESLint 9 #3693
alansemenov Sep 11, 2024
987b564
Revert "Publish SNAPSHOT from the epic branch"
alansemenov Sep 11, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ export class NavigatedAppPanel

addNavigablePanel(item: AppBarTabMenuItem, panel: Panel, select?: boolean) {
this.appBarTabMenu.addNavigationItem(item);
let index = this.addPanel(panel);
const index = this.addPanel(panel);
if (index === 1) {
this.appBar.setHomeIconAction();
}
if (select) {
this.selectPanelByIndex(index);
}
Expand All @@ -61,6 +64,10 @@ export class NavigatedAppPanel
this.appBarTabMenu.removeNavigationItem(navigationItem);
}

if (this.appBarTabMenu.countVisible() === 0) {
this.appBar.unsetHomeIconAction();
}

this.checkBrowsePanelNeedsToBeShown(index, panel);

return index;
Expand Down
8 changes: 7 additions & 1 deletion src/main/resources/assets/admin/common/js/app/bar/AppBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@ import {ShowAppLauncherAction} from './ShowAppLauncherAction';
import {AppIcon} from './AppIcon';
import {AppBarActions} from './AppBarActions';
import {Application} from '../Application';
import {IWCAG as WCAG, AriaRole} from '../../ui/WCAG';
import {i18n} from '../../util/Messages';

export class AppBar
extends DivEl
implements ActionContainer {
implements ActionContainer, WCAG {

[WCAG]: boolean = true;
ariaLabel: string = i18n('wcag.appbar.label');
role: AriaRole = AriaRole.BANNER;

protected application: Application;

Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/assets/admin/common/js/app/bar/AppIcon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ export class AppIcon
this.initListeners(action);
}
this.addClass('clickable');
this.getEl().setTabIndex(0);
this.makeTabbable();
this.onClicked(this.clickListener);
this.onKeyDown(this.enterListener);
}

removeAction(): void {
this.removeClass('clickable');
this.getEl().removeAttribute('tabindex');
this.removeTabbable();
this.unClicked(this.clickListener);
this.onKeyDown(this.enterListener);
}
Expand Down
25 changes: 7 additions & 18 deletions src/main/resources/assets/admin/common/js/app/bar/TabbedAppBar.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {ActionContainer} from '../../ui/ActionContainer';
import {ResponsiveManager} from '../../ui/responsive/ResponsiveManager';
import {AppBar} from './AppBar';
import {AppBarTabMenu} from './AppBarTabMenu';
import {Application} from '../Application';
Expand All @@ -17,23 +16,13 @@ export class TabbedAppBar

this.appendChild(this.tabMenu);

this.tabMenu.onNavigationItemAdded(() => this.updateAppOpenTabs());
this.tabMenu.onNavigationItemRemoved(() => this.updateAppOpenTabs());

// Responsive events to update homeButton styles
ResponsiveManager.onAvailableSizeChanged(this, () => {
if (this.tabMenu.countVisible() > 0) {
if (managedHomeIconAction) {
super.setHomeIconAction();
}
this.addClass('tabs-present');
} else {
if (managedHomeIconAction) {
super.unsetHomeIconAction();
}
this.removeClass('tabs-present');
}
});
const onNavigationItemAddedOrRemoved = () => {
this.updateAppOpenTabs();
this.toggleClass('tabs-present', this.tabMenu.countVisible() > 0);
};

this.tabMenu.onNavigationItemAdded(onNavigationItemAddedOrRemoved);
this.tabMenu.onNavigationItemRemoved(onNavigationItemAddedOrRemoved);
}

getTabMenu(): AppBarTabMenu {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {ActionButton} from '../../ui/button/ActionButton';
import {TreeGridActions} from '../../ui/treegrid/actions/TreeGridActions';
import {SplitPanel, SplitPanelAlignment, SplitPanelBuilder} from '../../ui/panel/SplitPanel';
import {Panel} from '../../ui/panel/Panel';
import {Toolbar} from '../../ui/toolbar/Toolbar';
import {Toolbar, ToolbarConfig} from '../../ui/toolbar/Toolbar';
import {TreeGrid} from '../../ui/treegrid/TreeGrid';
import {BrowseFilterPanel} from './filter/BrowseFilterPanel';
import {Action} from '../../ui/Action';
Expand All @@ -23,7 +23,7 @@ import {SplitPanelSize} from '../../ui/panel/SplitPanelSize';
export class BrowsePanel
extends Panel {

protected browseToolbar: Toolbar;
protected browseToolbar: Toolbar<ToolbarConfig>;

protected treeGrid: TreeGrid<ViewItem>;

Expand Down Expand Up @@ -208,6 +208,7 @@ export class BrowsePanel
this.showFilterPanel();
} else {
this.hideFilterPanel();
this.browseToolbar.giveFocus();
}
}

Expand All @@ -223,7 +224,7 @@ export class BrowsePanel
this.treeGrid.resetFilter();
}

protected createToolbar(): Toolbar {
protected createToolbar(): Toolbar<ToolbarConfig> {
throw Error('Must be implemented by inheritors');
}

Expand All @@ -244,6 +245,7 @@ export class BrowsePanel
}

protected showFilterPanel() {
this.browseToolbar.giveBlur();
this.filterPanelForcedShown = true;
this.filterPanelForcedHidden = false;

Expand All @@ -267,7 +269,6 @@ export class BrowsePanel
if (this.filterPanel.hasFilterSet()) {
this.toggleFilterPanelButton.addClass('filtered');
}

}

private toggleSelectionMode(isActive: boolean) {
Expand Down Expand Up @@ -298,18 +299,22 @@ export class BrowsePanel
.setAnimationDelay(100) // filter panel animation time
.build();

this.filterPanel.onHideFilterPanelButtonClicked(this.toggleFilterPanel.bind(this));
this.filterPanel.onHideFilterPanelButtonClicked(() => {
this.toggleFilterPanel();
});
this.filterPanel.onShowResultsButtonClicked(this.toggleFilterPanel.bind(this));

this.addToggleFilterPanelButtonInToolbar();
return splitPanel;
}

private addToggleFilterPanelButtonInToolbar() {
this.toggleFilterPanelAction = new ToggleFilterPanelAction(this);
this.toggleFilterPanelButton = new ActionButton(this.toggleFilterPanelAction);
this.toggleFilterPanelAction = new ToggleFilterPanelAction(this).setFoldable(false);
this.toggleFilterPanelAction.setWcagAttributes({
ariaLabel: i18n('tooltip.filterPanel.show')
});
this.toggleFilterPanelButton = this.browseToolbar.addAction(this.toggleFilterPanelAction);
this.toggleFilterPanelButton.setTitle(i18n('tooltip.filterPanel.show'));
this.browseToolbar.prependChild(this.toggleFilterPanelButton);
this.toggleFilterPanelAction.setVisible(false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {LabelEl} from '../../../dom/LabelEl';
import {ActionButton} from '../../../ui/button/ActionButton';
import {Action} from '../../../ui/Action';
import {DefaultErrorHandler} from '../../../DefaultErrorHandler';
import {AriaRole} from '../../../ui/WCAG';

export class BrowseFilterPanel<T>
extends Panel {
Expand All @@ -40,8 +41,14 @@ export class BrowseFilterPanel<T>
this.addClass('filter-panel');

this.hideFilterPanelButton = new SpanEl('hide-filter-panel-button icon-search');
this.hideFilterPanelButton.applyWCAGAttributes({
ariaLabel: i18n('tooltip.filterPanel.hide'),
role: AriaRole.BUTTON,
tabbable: true
});
this.hideFilterPanelButton.setTitle(i18n('tooltip.filterPanel.hide'));
this.hideFilterPanelButton.onClicked(() => this.notifyHidePanelButtonPressed());
this.hideFilterPanelButton.onApplyKeyPressed(() => this.notifyHidePanelButtonPressed());

let showResultsButtonWrapper = new DivEl('show-filter-results');
this.showResultsButton = new SpanEl('show-filter-results-button');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ import {IFrameEl} from '../../dom/IFrameEl';
import {Panel} from '../../ui/panel/Panel';
import {Equitable} from '../../Equitable';
import {ItemPreviewToolbar} from './ItemPreviewToolbar';
import {ToolbarConfig} from '../../ui/toolbar/Toolbar';

export class ItemPreviewPanel<M extends Equitable>
export class ItemPreviewPanel<M extends Equitable, C extends ToolbarConfig>
extends Panel {

protected frame: IFrameEl;

protected wrapper: DivEl;

protected toolbar: ItemPreviewToolbar<M>;
protected toolbar: ItemPreviewToolbar<M, C>;

protected mask: LoadMask;

Expand All @@ -26,8 +27,8 @@ export class ItemPreviewPanel<M extends Equitable>
this.appendChildren(this.toolbar, this.wrapper, this.mask);
}

createToolbar(): ItemPreviewToolbar<M> {
return new ItemPreviewToolbar<M>();
createToolbar(): ItemPreviewToolbar<M, C> {
return new ItemPreviewToolbar<M, C>();
}

public showMask() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import {Equitable} from '../../Equitable';
import {Toolbar} from '../../ui/toolbar/Toolbar';
import {Toolbar, ToolbarConfig} from '../../ui/toolbar/Toolbar';

export class ItemPreviewToolbar<M extends Equitable>
extends Toolbar {
export class ItemPreviewToolbar<M extends Equitable, C extends ToolbarConfig>
extends Toolbar<C> {

private item: M;

constructor(className?: string) {
super('item-preview-toolbar' + (className ? ' ' + className : ''));
constructor(config?: C) {
super(config);

this.addClass('item-preview-toolbar');
}

setItem(item: M) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Panel} from '../../ui/panel/Panel';
import {Closeable} from '../../ui/Closeable';
import {Toolbar} from '../../ui/toolbar/Toolbar';
import {Toolbar, ToolbarConfig} from '../../ui/toolbar/Toolbar';
import {Action} from '../../ui/Action';
import {ItemViewClosedEvent} from './ItemViewClosedEvent';
import {ViewItem} from './ViewItem';
Expand All @@ -9,7 +9,7 @@ export class ItemViewPanel
extends Panel
implements Closeable {

private toolbar: Toolbar;
private toolbar: Toolbar<ToolbarConfig>;

private panel: Panel;

Expand All @@ -21,7 +21,7 @@ export class ItemViewPanel
super('item-view-panel');
}

setToolbar(toolbar: Toolbar) {
setToolbar(toolbar: Toolbar<ToolbarConfig>) {
this.toolbar = toolbar;
this.appendChild(this.toolbar);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Q from 'q';
import {Toolbar} from '../../ui/toolbar/Toolbar';
import {Toolbar, ToolbarConfig} from '../../ui/toolbar/Toolbar';
import {ResponsiveManager} from '../../ui/responsive/ResponsiveManager';
import {ResponsiveItem} from '../../ui/responsive/ResponsiveItem';
import {Panel} from '../../ui/panel/Panel';
Expand Down Expand Up @@ -47,7 +47,7 @@ export class WizardPanel<EQUITABLE extends Equitable>
protected params: WizardPanelParams<EQUITABLE>;
protected wizardActions: WizardActions<EQUITABLE>;
protected wizardHeader: WizardHeader;
protected mainToolbar: Toolbar;
protected mainToolbar: Toolbar<ToolbarConfig>;
protected formIcon: Element;
protected formMask: LoadMask;
protected liveMask: LoadMask;
Expand Down Expand Up @@ -249,7 +249,7 @@ export class WizardPanel<EQUITABLE extends Equitable>
});
}

public getMainToolbar(): Toolbar {
public getMainToolbar(): Toolbar<ToolbarConfig> {
return this.mainToolbar;
}

Expand Down Expand Up @@ -620,7 +620,7 @@ export class WizardPanel<EQUITABLE extends Equitable>
return this.dataLoaded;
}

protected createMainToolbar(): Toolbar {
protected createMainToolbar(): Toolbar<ToolbarConfig> {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Q from 'q';
import {Toolbar} from '../../ui/toolbar/Toolbar';
import {Toolbar, ToolbarConfig} from '../../ui/toolbar/Toolbar';
import {TabBarItem} from '../../ui/tab/TabBarItem';
import {ActivatedEvent} from '../../ui/ActivatedEvent';
import {DivEl} from '../../dom/DivEl';
Expand All @@ -15,13 +15,13 @@ export class WizardStepNavigatorAndToolbar

private foldButton: FoldButton;

private stepToolbar: Toolbar;
private stepToolbar: Toolbar<ToolbarConfig>;

private stepNavigator: WizardStepNavigator;

private helpTextToggleButton: DivEl;

constructor(stepNavigator: WizardStepNavigator, stepToolbar?: Toolbar) {
constructor(stepNavigator: WizardStepNavigator, stepToolbar?: Toolbar<ToolbarConfig>) {
super('wizard-step-navigator-and-toolbar');
this.stepNavigator = stepNavigator;
this.stepToolbar = stepToolbar;
Expand Down
Loading
Loading