@brightspace-ui/core 3.180.0 → 3.182.0
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.
|
@@ -8,8 +8,6 @@ import { menuItemStyles } from './menu-item-styles.js';
|
|
|
8
8
|
|
|
9
9
|
const newWindowIconEnabled = getFlag('GAUD-8295-menu-item-link-new-window-icon', true);
|
|
10
10
|
|
|
11
|
-
const menuItemClickChangesEnabled = getFlag('GAUD-8369-menu-item-link-click-changes', true);
|
|
12
|
-
|
|
13
11
|
/**
|
|
14
12
|
* A menu item component used for navigating.
|
|
15
13
|
* @fires click - Dispatched when the link is clicked
|
|
@@ -105,7 +103,6 @@ class MenuItemLink extends (newWindowIconEnabled ? LinkMixin(MenuItemMixin(LitEl
|
|
|
105
103
|
|
|
106
104
|
firstUpdated() {
|
|
107
105
|
super.firstUpdated();
|
|
108
|
-
if (!menuItemClickChangesEnabled) this.addEventListener('click', this._onClick); // remove when cleaning up GAUD-8369-menu-item-link-click-changes
|
|
109
106
|
this.addEventListener('keydown', this._onKeyDown);
|
|
110
107
|
}
|
|
111
108
|
|
|
@@ -142,41 +139,9 @@ class MenuItemLink extends (newWindowIconEnabled ? LinkMixin(MenuItemMixin(LitEl
|
|
|
142
139
|
return label && this.target === '_blank' ? this.localize('components.link.open-in-new-window') : undefined;
|
|
143
140
|
}
|
|
144
141
|
|
|
145
|
-
// remove this function when cleaning up GAUD-8369-menu-item-link-click-changes
|
|
146
|
-
_getTarget() {
|
|
147
|
-
if (this.target && this.target !== '') {
|
|
148
|
-
return this.target;
|
|
149
|
-
}
|
|
150
|
-
let base = document.getElementsByTagName('base');
|
|
151
|
-
if (base && base.length > 0) {
|
|
152
|
-
base = base[0];
|
|
153
|
-
return base.getAttribute('target');
|
|
154
|
-
}
|
|
155
|
-
return null;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
// remove this function when cleaning up GAUD-8369-menu-item-link-click-changes
|
|
159
|
-
_onClick() {
|
|
160
|
-
if (this.shadowRoot) this.shadowRoot.querySelector('a').dispatchEvent(new CustomEvent('click'));
|
|
161
|
-
}
|
|
162
|
-
|
|
163
142
|
_onKeyDown(e) {
|
|
164
|
-
if (
|
|
165
|
-
|
|
166
|
-
this.shadowRoot.querySelector('a').click();
|
|
167
|
-
}
|
|
168
|
-
} else { // remove this block when cleaning up GAUD-8369-menu-item-link-click-changes
|
|
169
|
-
super._onKeyDown(e);
|
|
170
|
-
if (e.keyCode === this.__keyCodes.ENTER || e.keyCode === this.__keyCodes.SPACE) {
|
|
171
|
-
const target = this._getTarget();
|
|
172
|
-
if (target === '_parent') {
|
|
173
|
-
window.parent.location.assign(this.href);
|
|
174
|
-
} else if (target === '_top') {
|
|
175
|
-
window.top.location.assign(this.href);
|
|
176
|
-
} else {
|
|
177
|
-
window.location.assign(this.href);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
143
|
+
if (e.keyCode === this.__keyCodes.ENTER || e.keyCode === this.__keyCodes.SPACE) {
|
|
144
|
+
this.shadowRoot.querySelector('a').click();
|
|
180
145
|
}
|
|
181
146
|
}
|
|
182
147
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { getFlag } from '../../helpers/flags.js';
|
|
2
1
|
import { PropertyRequiredMixin } from '../../mixins/property-required/property-required-mixin.js';
|
|
3
2
|
|
|
4
3
|
const defaultLines = 2;
|
|
5
|
-
const menuItemClickChangesEnabled = getFlag('GAUD-8369-menu-item-link-click-changes', true);
|
|
6
4
|
|
|
7
5
|
export const MenuItemMixin = superclass => class extends PropertyRequiredMixin(superclass) {
|
|
8
6
|
|
|
@@ -156,11 +154,7 @@ export const MenuItemMixin = superclass => class extends PropertyRequiredMixin(s
|
|
|
156
154
|
}
|
|
157
155
|
|
|
158
156
|
__onClick(e) {
|
|
159
|
-
if (
|
|
160
|
-
if (!this._letClickPropagate) e.stopPropagation();
|
|
161
|
-
} else { // remove this block when cleaning up GAUD-8369-menu-item-link-click-changes
|
|
162
|
-
e.stopPropagation();
|
|
163
|
-
}
|
|
157
|
+
if (!this._letClickPropagate) e.stopPropagation();
|
|
164
158
|
|
|
165
159
|
this.__action();
|
|
166
160
|
}
|
package/helpers/focus.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { css, unsafeCSS } from 'lit';
|
|
2
2
|
import { getComposedChildren, getComposedParent, getFirstVisibleAncestor, getNextAncestorSibling, getPreviousAncestorSibling, isVisible } from './dom.js';
|
|
3
|
-
import { getFlag } from './flags.js';
|
|
4
3
|
|
|
5
4
|
const focusableElements = {
|
|
6
5
|
a: true,
|
|
@@ -15,9 +14,6 @@ const focusableElements = {
|
|
|
15
14
|
textarea: true
|
|
16
15
|
};
|
|
17
16
|
|
|
18
|
-
// The default here cannot be changed, as BSI relies on it being true. Do not change the default without adding a way for BSI to override it.
|
|
19
|
-
const focusVisibleSupportChangesEnabled = getFlag('focus-visible-support-changes-for-focus-rings', true);
|
|
20
|
-
|
|
21
17
|
export function getComposedActiveElement() {
|
|
22
18
|
let node = document.activeElement;
|
|
23
19
|
|
|
@@ -80,22 +76,6 @@ export function getFocusPseudoClass() {
|
|
|
80
76
|
return isFocusVisibleSupported() ? 'focus-visible' : 'focus';
|
|
81
77
|
}
|
|
82
78
|
export function getFocusRingStyles(selector, { extraStyles = null } = {}) {
|
|
83
|
-
// Remove when cleaning up focus-visible-support-changes-for-focus-rings
|
|
84
|
-
if (!focusVisibleSupportChangesEnabled) {
|
|
85
|
-
const selectorDelegate = typeof selector === 'string' ? pseudoClass => `${selector}:${pseudoClass}` : selector;
|
|
86
|
-
const cssSelector = unsafeCSS(selectorDelegate(getFocusPseudoClass()));
|
|
87
|
-
return css`${cssSelector} {
|
|
88
|
-
${extraStyles ?? css``}
|
|
89
|
-
outline: 2px solid var(--d2l-focus-ring-color, var(--d2l-color-celestine));
|
|
90
|
-
outline-offset: var(--d2l-focus-ring-offset, 2px);
|
|
91
|
-
}
|
|
92
|
-
@media (prefers-contrast: more) {
|
|
93
|
-
${cssSelector} {
|
|
94
|
-
outline-color: Highlight;
|
|
95
|
-
}
|
|
96
|
-
}`;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
79
|
const stylesDelegate = selector => css`
|
|
100
80
|
${selector} {
|
|
101
81
|
${extraStyles ?? css``}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.182.0",
|
|
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",
|