@douyinfe/semi-foundation 2.15.0 → 2.15.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/dropdown/foundation.ts +1 -1
- package/dropdown/menuFoundation.ts +1 -1
- package/lib/cjs/dropdown/foundation.js +1 -1
- package/lib/cjs/dropdown/menuFoundation.js +1 -1
- package/lib/cjs/utils/a11y.js +2 -2
- package/lib/es/dropdown/foundation.js +1 -1
- package/lib/es/dropdown/menuFoundation.js +1 -1
- package/lib/es/utils/a11y.js +2 -2
- package/package.json +2 -2
- package/utils/a11y.ts +2 -2
package/dropdown/foundation.ts
CHANGED
|
@@ -13,7 +13,7 @@ export default class DropdownFoundation extends BaseFoundation<DropdownAdapter>
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
getMenuItemNodes(target: any): HTMLElement[] {
|
|
16
|
-
const id = target.attributes['data-
|
|
16
|
+
const id = target.attributes['data-popupid'].value;
|
|
17
17
|
const menuWrapper = document.getElementById(id);
|
|
18
18
|
// if has dropdown item, the item must wrapped by li
|
|
19
19
|
return menuWrapper ? Array.from(menuWrapper.getElementsByTagName('li')).filter(item => item.ariaDisabled === "false") : null;
|
|
@@ -20,7 +20,7 @@ export default class DropdownMenuFoundation extends BaseFoundation<Partial<Defau
|
|
|
20
20
|
handleEscape(menu: Element): void {
|
|
21
21
|
const trigger = this._adapter.getContext('trigger');
|
|
22
22
|
if (trigger === 'custom'){
|
|
23
|
-
const menuButton = menu && getMenuButton(document.querySelectorAll(`[data-
|
|
23
|
+
const menuButton = menu && getMenuButton(document.querySelectorAll(`[data-popupid]`), menu.id);
|
|
24
24
|
menuButton.focus();
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -28,7 +28,7 @@ class DropdownFoundation extends _foundation.default {
|
|
|
28
28
|
getMenuItemNodes(target) {
|
|
29
29
|
var _context;
|
|
30
30
|
|
|
31
|
-
const id = target.attributes['data-
|
|
31
|
+
const id = target.attributes['data-popupid'].value;
|
|
32
32
|
const menuWrapper = document.getElementById(id); // if has dropdown item, the item must wrapped by li
|
|
33
33
|
|
|
34
34
|
return menuWrapper ? (0, _filter.default)(_context = (0, _from.default)(menuWrapper.getElementsByTagName('li'))).call(_context, item => item.ariaDisabled === "false") : null;
|
|
@@ -46,7 +46,7 @@ class DropdownMenuFoundation extends _foundation.default {
|
|
|
46
46
|
const trigger = this._adapter.getContext('trigger');
|
|
47
47
|
|
|
48
48
|
if (trigger === 'custom') {
|
|
49
|
-
const menuButton = menu && (0, _a11y.getMenuButton)(document.querySelectorAll("[data-
|
|
49
|
+
const menuButton = menu && (0, _a11y.getMenuButton)(document.querySelectorAll("[data-popupid]"), menu.id);
|
|
50
50
|
menuButton.focus();
|
|
51
51
|
}
|
|
52
52
|
}
|
package/lib/cjs/utils/a11y.js
CHANGED
|
@@ -121,12 +121,12 @@ function getAncestorNodeByRole(curElement, role) {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
return curElement.parentElement;
|
|
124
|
-
} // According to the Id, find the corresponding data-
|
|
124
|
+
} // According to the Id, find the corresponding data-popupid element
|
|
125
125
|
|
|
126
126
|
|
|
127
127
|
function getMenuButton(focusableEle, Id) {
|
|
128
128
|
for (let i = 0; i < focusableEle.length; i++) {
|
|
129
|
-
const curAriDescribedby = focusableEle[i].attributes['data-
|
|
129
|
+
const curAriDescribedby = focusableEle[i].attributes['data-popupid'];
|
|
130
130
|
|
|
131
131
|
if (curAriDescribedby && curAriDescribedby.value === Id) {
|
|
132
132
|
return focusableEle[i];
|
|
@@ -12,7 +12,7 @@ export default class DropdownFoundation extends BaseFoundation {
|
|
|
12
12
|
getMenuItemNodes(target) {
|
|
13
13
|
var _context;
|
|
14
14
|
|
|
15
|
-
const id = target.attributes['data-
|
|
15
|
+
const id = target.attributes['data-popupid'].value;
|
|
16
16
|
const menuWrapper = document.getElementById(id); // if has dropdown item, the item must wrapped by li
|
|
17
17
|
|
|
18
18
|
return menuWrapper ? _filterInstanceProperty(_context = _Array$from(menuWrapper.getElementsByTagName('li'))).call(_context, item => item.ariaDisabled === "false") : null;
|
|
@@ -28,7 +28,7 @@ export default class DropdownMenuFoundation extends BaseFoundation {
|
|
|
28
28
|
const trigger = this._adapter.getContext('trigger');
|
|
29
29
|
|
|
30
30
|
if (trigger === 'custom') {
|
|
31
|
-
const menuButton = menu && getMenuButton(document.querySelectorAll("[data-
|
|
31
|
+
const menuButton = menu && getMenuButton(document.querySelectorAll("[data-popupid]"), menu.id);
|
|
32
32
|
menuButton.focus();
|
|
33
33
|
}
|
|
34
34
|
}
|
package/lib/es/utils/a11y.js
CHANGED
|
@@ -90,11 +90,11 @@ export function getAncestorNodeByRole(curElement, role) {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
return curElement.parentElement;
|
|
93
|
-
} // According to the Id, find the corresponding data-
|
|
93
|
+
} // According to the Id, find the corresponding data-popupid element
|
|
94
94
|
|
|
95
95
|
export function getMenuButton(focusableEle, Id) {
|
|
96
96
|
for (let i = 0; i < focusableEle.length; i++) {
|
|
97
|
-
const curAriDescribedby = focusableEle[i].attributes['data-
|
|
97
|
+
const curAriDescribedby = focusableEle[i].attributes['data-popupid'];
|
|
98
98
|
|
|
99
99
|
if (curAriDescribedby && curAriDescribedby.value === Id) {
|
|
100
100
|
return focusableEle[i];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-foundation",
|
|
3
|
-
"version": "2.15.
|
|
3
|
+
"version": "2.15.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build:lib": "node ./scripts/compileLib.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"*.scss",
|
|
25
25
|
"*.css"
|
|
26
26
|
],
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "c17dbc08573d010f8ecfe60834412acd9e7ca154",
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
30
30
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
package/utils/a11y.ts
CHANGED
|
@@ -97,10 +97,10 @@ export function getAncestorNodeByRole(curElement: Element, role: string): Elemen
|
|
|
97
97
|
return curElement.parentElement;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
// According to the Id, find the corresponding data-
|
|
100
|
+
// According to the Id, find the corresponding data-popupid element
|
|
101
101
|
export function getMenuButton(focusableEle: NodeListOf<HTMLElement>, Id: string): HTMLElement{
|
|
102
102
|
for (let i = 0; i < focusableEle.length; i++){
|
|
103
|
-
const curAriDescribedby = focusableEle[i].attributes['data-
|
|
103
|
+
const curAriDescribedby = focusableEle[i].attributes['data-popupid'];
|
|
104
104
|
if (curAriDescribedby && curAriDescribedby.value === Id){
|
|
105
105
|
return focusableEle[i];
|
|
106
106
|
}
|