Skip to content

feat(ui5-multicombobox): implement ACC support #937

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

Merged
merged 6 commits into from
Nov 18, 2019
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion packages/main/src/MultiComboBox.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
@focusin={{rootFocusIn}}
@focusout={{rootFocusOut}}
>
<span id="{{_id}}-hiddenText-nMore" class="ui5-hidden-text">{{nMoreCountText}}</span>

<ui5-tokenizer slot="_beginContent"
show-more
class="ui5-multi-combobox-tokenizer"
Expand Down Expand Up @@ -30,7 +32,10 @@
@keydown="{{_onkeydown}}"
@keyup="{{_onkeyup}}"
@focusin="{{_focusin}}"
@focusout="{{_focusout}}">
@focusout="{{_focusout}}"
role="combobox"
aria-haspopup="listbox"
aria-labelledby="{{_id}}-hiddenText-nMore">
</input>

{{#unless readonly}}
Expand Down
8 changes: 8 additions & 0 deletions packages/main/src/MultiComboBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ import {
import "./icons/slim-arrow-down.js";
import { getRTL } from "@ui5/webcomponents-base/dist/config/RTL.js";
import { isIE } from "@ui5/webcomponents-core/dist/sap/ui/Device.js";
import { fetchI18nBundle, getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js";
import MultiComboBoxTemplate from "./generated/templates/MultiComboBoxTemplate.lit.js";
import Tokenizer from "./Tokenizer.js";
import Token from "./Token.js";
import Icon from "./Icon.js";
import Popover from "./Popover.js";
import List from "./List.js";
import StandardListItem from "./StandardListItem.js";
import { TOKENIZER_ARIA_CONTAIN_SEVERAL_TOKENS } from "../dist/generated/i18n/i18n-defaults.js";

// Styles
import styles from "./generated/themes/MultiComboBox.css.js";
Expand Down Expand Up @@ -254,6 +256,7 @@ class MultiComboBox extends UI5Element {
this._inputLastValue = "";
this._deleting = false;
this._validationTimeout = null;
this.i18nBundle = getI18nBundle("@ui5/webcomponents");
}

_inputChange() {
Expand Down Expand Up @@ -462,6 +465,10 @@ class MultiComboBox extends UI5Element {
return this.shadowRoot.querySelector("ui5-tokenizer");
}

get nMoreCountText() {
return this.i18nBundle.getText(TOKENIZER_ARIA_CONTAIN_SEVERAL_TOKENS, this._getSelectedItems().length);
}

rootFocusIn() {
this.expandedTokenizer = true;
}
Expand Down Expand Up @@ -492,6 +499,7 @@ class MultiComboBox extends UI5Element {
Popover.define(),
List.define(),
StandardListItem.define(),
fetchI18nBundle("@ui5/webcomponents"),
]);

super.define(...params);
Expand Down
18 changes: 16 additions & 2 deletions packages/main/src/Token.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
<div tabindex="{{_tabIndex}}" @click="{{_select}}" @keydown="{{_keydown}}" class="ui5-token--wrapper" dir="{{dir}}">
<div
tabindex="{{_tabIndex}}"
@click="{{_select}}"
@keydown="{{_keydown}}"
class="ui5-token--wrapper"
dir="{{dir}}"
role="option"
aria-selected="{{selected}}"
>
<span class="ui5-token--text"><slot></slot></span>

{{#unless readonly}}
<ui5-icon @click="{{_delete}}" name="{{iconURI}}" accessible-name="{{tokenDeletableText}}" show-tooltip="true" class="ui5-token--icon"></ui5-icon>
<ui5-icon
@click="{{_delete}}"
src="{{iconURI}}"
accessible-name="{{tokenDeletableText}}"
show-tooltip
class="ui5-token--icon"
></ui5-icon>
{{/unless}}
</div>
18 changes: 15 additions & 3 deletions packages/main/src/Tokenizer.hbs
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
<div class="{{classes.wrapper}}">
<div class="{{classes.content}}" @ui5-delete={{_tokenDelete}}>
<div
class="{{classes.wrapper}}"
>
<span id="{{_id}}-hiddenText" class="ui5-hidden-text">{{tokenizerLabel}}</span>

<div
class="{{classes.content}}"
@ui5-delete="{{_tokenDelete}}"
role="listbox"
aria-labelledby="{{_id}}-hiddenText"
>
{{#each tokens}}
<slot name="{{this._individualSlot}}"></slot>
{{/each}}
</div>

{{#if showNMore}}
<span @click="{{_openOverflowPopover}}" class="ui5-tokenizer-more-text">{{_nMoreText}}</span>
<span
@click="{{_openOverflowPopover}}"
class="ui5-tokenizer-more-text"
>{{_nMoreText}}</span>
{{/if}}
</div>
5 changes: 5 additions & 0 deletions packages/main/src/Tokenizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import ItemNavigation from "@ui5/webcomponents-base/dist/delegate/ItemNavigation
import { fetchI18nBundle, getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js";
import TokenizerTemplate from "./generated/templates/TokenizerTemplate.lit.js";
import { MULTIINPUT_SHOW_MORE_TOKENS } from "./generated/i18n/i18n-defaults.js";
import { TOKENIZER_ARIA_LABEL } from "../dist/generated/i18n/i18n-defaults.js";

// Styles
import styles from "./generated/themes/Tokenizer.css.js";
Expand Down Expand Up @@ -182,6 +183,10 @@ class Tokenizer extends UI5Element {
return this.shadowRoot.querySelector(".ui5-tokenizer--content");
}

get tokenizerLabel() {
return this.i18nBundle.getText(TOKENIZER_ARIA_LABEL);
}

get overflownTokens() {
if (!this.contentDom) {
return [];
Expand Down
6 changes: 6 additions & 0 deletions packages/main/src/i18n/messagebundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,12 @@ TEXTAREA_CHARACTERS_EXCEEDED={0} characters over limit
#XACT: ARIA announcement for token deletable
TOKEN_ARIA_DELETABLE=Deletable

#XACT: ARIA announcement for tokenizer with n tokens
TOKENIZER_ARIA_CONTAIN_SEVERAL_TOKENS=Contains {0} tokens

#XACT: ARIA announcement for tokenizer label
TOKENIZER_ARIA_LABEL=Tokenizer

#XTOL: text that is appended to the tooltips of input fields etc. which are marked to have an error
VALUE_STATE_ERROR=Invalid entry

Expand Down
1 change: 1 addition & 0 deletions packages/main/src/themes/MultiComboBox.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@import "./Input.css";
@import "./InputIcon.css";
@import "./InvisibleTextStyles.css";

:host(:not([hidden])) {
display: inline-block;
Expand Down
2 changes: 2 additions & 0 deletions packages/main/src/themes/Tokenizer.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import "./InvisibleTextStyles.css";

:host {
display: inline-block;
box-sizing: border-box;
Expand Down