mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-03 16:10:26 +00:00
[a11y] share dialog: make tab panels accessible by keyboard
This commit is contained in:
@@ -1435,35 +1435,35 @@ export const Utils = {
|
||||
var num = 0;
|
||||
|
||||
if (pwd.length < shareLinkPasswordMinLength) {
|
||||
return 0;
|
||||
return 0;
|
||||
} else {
|
||||
for (var i = 0; i < pwd.length; i++) {
|
||||
// return the unicode
|
||||
// bitwise OR
|
||||
num |= _this.getCharMode(pwd.charCodeAt(i));
|
||||
}
|
||||
return _this.calculateBitwise(num);
|
||||
for (var i = 0; i < pwd.length; i++) {
|
||||
// return the unicode
|
||||
// bitwise OR
|
||||
num |= _this.getCharMode(pwd.charCodeAt(i));
|
||||
}
|
||||
return _this.calculateBitwise(num);
|
||||
}
|
||||
},
|
||||
|
||||
getCharMode: function(n) {
|
||||
if (n >= 48 && n <= 57) // nums
|
||||
return 1;
|
||||
return 1;
|
||||
if (n >= 65 && n <= 90) // uppers
|
||||
return 2;
|
||||
return 2;
|
||||
if (n >= 97 && n <= 122) // lowers
|
||||
return 4;
|
||||
return 4;
|
||||
else
|
||||
return 8;
|
||||
return 8;
|
||||
},
|
||||
|
||||
calculateBitwise: function(num) {
|
||||
var level = 0;
|
||||
for (var i = 0; i < 4; i++){
|
||||
// bitwise AND
|
||||
if (num&1) level++;
|
||||
// Right logical shift
|
||||
num>>>=1;
|
||||
// bitwise AND
|
||||
if (num&1) level++;
|
||||
// Right logical shift
|
||||
num>>>=1;
|
||||
}
|
||||
return level;
|
||||
},
|
||||
@@ -1498,4 +1498,11 @@ export const Utils = {
|
||||
return { isCustomPermission: false };
|
||||
}
|
||||
|
||||
// for a11y
|
||||
onKeyDown: function(e) {
|
||||
if (e.key == 'Enter' || e.key == 'Space') {
|
||||
e.target.click();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
Reference in New Issue
Block a user