@brightspace-ui/labs 2.20.0 → 2.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { css, html, LitElement } from 'lit';
|
|
2
2
|
import { highlightBorderStyles, highlightButtonStyles } from './navigation-styles.js';
|
|
3
3
|
import { DropdownOpenerMixin } from '@brightspace-ui/core/components/dropdown/dropdown-opener-mixin.js';
|
|
4
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
4
5
|
|
|
5
6
|
class NavigationDropdownButtonCustom extends DropdownOpenerMixin(LitElement) {
|
|
6
7
|
|
|
8
|
+
static get properties() {
|
|
9
|
+
return {
|
|
10
|
+
openerLabel: { type: String, attribute: 'opener-label' }
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
7
14
|
static get styles() {
|
|
8
15
|
return [highlightBorderStyles, highlightButtonStyles, css`
|
|
9
16
|
:host {
|
|
@@ -19,7 +26,10 @@ class NavigationDropdownButtonCustom extends DropdownOpenerMixin(LitElement) {
|
|
|
19
26
|
|
|
20
27
|
render() {
|
|
21
28
|
return html`
|
|
22
|
-
<button
|
|
29
|
+
<button
|
|
30
|
+
type="button"
|
|
31
|
+
aria-haspopup="menu"
|
|
32
|
+
aria-label="${ifDefined(this.openerLabel)}">
|
|
23
33
|
<span class="d2l-labs-navigation-highlight-border"></span>
|
|
24
34
|
<slot name="opener"></slot>
|
|
25
35
|
</button>
|
|
@@ -44,14 +44,9 @@ class NavigationSkip extends FocusMixin(PropertyRequiredMixin(LitElement)) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
render() {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
_handleKeyDown(e) {
|
|
51
|
-
if (e.keyCode === 13) {
|
|
52
|
-
e.preventDefault();
|
|
53
|
-
this.dispatchEvent(new CustomEvent('click', { bubbles: true, composed: true }));
|
|
54
|
-
}
|
|
47
|
+
// Href attribute is needed for a11y tools to recognize anchor as a link
|
|
48
|
+
// and for click events to be dispatched using key presses
|
|
49
|
+
return html`<a href="javascript:void(0);" class="vdiff-target">${this.text}</a>`;
|
|
55
50
|
}
|
|
56
51
|
|
|
57
52
|
}
|