@brightspace-ui/core 3.66.0 → 3.66.2
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.
@@ -2,7 +2,6 @@ import { css, html, LitElement } from 'lit';
|
|
2
2
|
|
3
3
|
/**
|
4
4
|
* A button container component for button toggles.
|
5
|
-
* @fires click - Internal event
|
6
5
|
*/
|
7
6
|
class ButtonToggle extends LitElement {
|
8
7
|
|
@@ -79,28 +78,17 @@ class ButtonToggle extends LitElement {
|
|
79
78
|
elem.focus();
|
80
79
|
}
|
81
80
|
|
82
|
-
_clickCancelled(e) {
|
83
|
-
e.stopPropagation();
|
84
|
-
const customClick = new CustomEvent('click', {
|
85
|
-
cancelable: true
|
86
|
-
});
|
87
|
-
e.target.dispatchEvent(customClick);
|
88
|
-
return customClick.defaultPrevented;
|
89
|
-
}
|
90
|
-
|
91
81
|
async _handleClick(pressed) {
|
92
82
|
this.pressed = pressed;
|
93
83
|
await this.updateComplete;
|
94
84
|
this.focus();
|
95
85
|
}
|
96
86
|
|
97
|
-
_handleNotPressedClick(
|
98
|
-
if (this._clickCancelled(e)) return;
|
87
|
+
_handleNotPressedClick() {
|
99
88
|
this._handleClick(true);
|
100
89
|
}
|
101
90
|
|
102
|
-
_handlePressedClick(
|
103
|
-
if (this._clickCancelled(e)) return;
|
91
|
+
_handlePressedClick() {
|
104
92
|
this._handleClick(false);
|
105
93
|
}
|
106
94
|
|
@@ -54,30 +54,6 @@
|
|
54
54
|
</template>
|
55
55
|
</d2l-demo-snippet>
|
56
56
|
|
57
|
-
<h2>Toggle Button (consumer manages state)</h2>
|
58
|
-
|
59
|
-
<d2l-demo-snippet>
|
60
|
-
<template>
|
61
|
-
<d2l-button-toggle id="toggle-button-icon-consumer-manage-state">
|
62
|
-
<d2l-button-icon slot="not-pressed" icon="tier1:pin-hollow" text="Unpinned, click to pin." id="button-icon-not-pressed"></d2l-button-icon>
|
63
|
-
<d2l-button-icon slot="pressed" icon="tier1:pin-filled" text="Pinned, click to unpin." id="button-icon-pressed"></d2l-button-icon>
|
64
|
-
</d2l-button-toggle>
|
65
|
-
<script>
|
66
|
-
const buttonToggle = document.querySelector('#toggle-button-icon-consumer-manage-state');
|
67
|
-
buttonToggle.addEventListener('d2l-button-toggle-change', e => console.log(e));
|
68
|
-
|
69
|
-
document.querySelector('#button-icon-not-pressed').addEventListener('click', (e) => {
|
70
|
-
e.preventDefault();
|
71
|
-
buttonToggle.pressed = true;
|
72
|
-
});
|
73
|
-
document.querySelector('#button-icon-pressed').addEventListener('click', (e) => {
|
74
|
-
e.preventDefault();
|
75
|
-
buttonToggle.pressed = false;
|
76
|
-
});
|
77
|
-
</script>
|
78
|
-
</template>
|
79
|
-
</d2l-demo-snippet>
|
80
|
-
|
81
57
|
</d2l-demo-page>
|
82
58
|
|
83
59
|
</body>
|
@@ -486,7 +486,7 @@ class InputText extends InputInlineHelpMixin(PropertyRequiredMixin(FocusMixin(La
|
|
486
486
|
let tooltip = nothing;
|
487
487
|
if (!this.skeleton) {
|
488
488
|
if (this.validationError && !this.noValidate) {
|
489
|
-
// this tooltip is using "announced" since we don't want aria-describedby wire-up
|
489
|
+
// this tooltip is using "announced" since we don't want aria-describedby wire-up - VoiceOver ignores our message when the input is invalid
|
490
490
|
tooltip = html`<d2l-tooltip state="error" announced align="start" class="vdiff-target">${this.validationError} <span class="d2l-offscreen">${this.description}</span></d2l-tooltip>`;
|
491
491
|
} else if (this.instructions) {
|
492
492
|
tooltip = html`<d2l-tooltip align="start" for="${this._inputId}" delay="1000" class="vdiff-target">${this.instructions}</d2l-tooltip>`;
|
@@ -730,9 +730,13 @@ class Tooltip extends RtlMixin(LitElement) {
|
|
730
730
|
target = ownerRoot.querySelector(targetSelector);
|
731
731
|
target = target || ownerRoot?.host?.querySelector(targetSelector);
|
732
732
|
} else {
|
733
|
-
console.warn('<d2l-tooltip>: missing required attribute "for"');
|
734
733
|
const parentNode = this.parentNode;
|
735
734
|
target = parentNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? ownerRoot.host : parentNode;
|
735
|
+
|
736
|
+
// reduce console pollution since Safari + VO prevents inadequate SR experience for tooltips during form validation when using 'for'
|
737
|
+
if (!(target.tagName === 'D2L-INPUT-TEXT' && target?.invalid)) {
|
738
|
+
console.warn('<d2l-tooltip>: missing required attribute "for"');
|
739
|
+
}
|
736
740
|
}
|
737
741
|
return target;
|
738
742
|
}
|
package/custom-elements.json
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@brightspace-ui/core",
|
3
|
-
"version": "3.66.
|
3
|
+
"version": "3.66.2",
|
4
4
|
"description": "A collection of accessible, free, open-source web components for building Brightspace applications",
|
5
5
|
"type": "module",
|
6
6
|
"repository": "https://github.com/BrightspaceUI/core.git",
|