[Bf-docboard-svn] bf-manual: [7963] trunk/blender_docs/resources/theme/js/version_switch.js: version switch: fix tab nav
Tobias Heinke
noreply at blender.org
Sun Apr 18 08:55:41 CEST 2021
Revision: 7963
https://developer.blender.org/rBM7963
Author: TobiasH
Date: 2021-04-18 08:55:41 +0200 (Sun, 18 Apr 2021)
Log Message:
-----------
version switch: fix tab nav
revert back to focusout, replace bubbling by child has focus search
Modified Paths:
--------------
trunk/blender_docs/resources/theme/js/version_switch.js
Modified: trunk/blender_docs/resources/theme/js/version_switch.js
===================================================================
--- trunk/blender_docs/resources/theme/js/version_switch.js 2021-04-18 02:35:22 UTC (rev 7962)
+++ trunk/blender_docs/resources/theme/js/version_switch.js 2021-04-18 06:55:41 UTC (rev 7963)
@@ -180,8 +180,8 @@
this.$dialog.attr("aria-hidden", false);
this.$btn.html(this.listlabel);
this.$dialog.fadeIn(speed, function() {
- that.$btn.parent().on("blur", function(e) {that.outHandler(); e.stopImmediatePropagation();})
- that.$btn.parent().on("mouseleave", function(e){that.outHandler(); e.stopImmediatePropagation();});
+ that.$btn.parent().on("focusout", function(e) {that.focusoutHandler(); e.stopImmediatePropagation();})
+ that.$btn.parent().on("mouseleave", function(e){that.mouseoutHandler(); e.stopImmediatePropagation();});
});
this.isOpen = true;
} else {
@@ -190,12 +190,11 @@
this.$btn.attr("aria-pressed", false);
this.$dialog.attr("aria-hidden", true);
this.$btn.html(this.label);
- this.$btn.parent().off("blur");
+ this.$btn.parent().off("focusout");
this.$btn.parent().off("mouseleave");
- // this.$dialog.off("focusout");
this.$dialog.fadeOut(speed, function() {
+ that.$btn.attr("tabindex", 0);
if(document.activeElement !== null && document.activeElement !== document && document.activeElement !== document.body) {
- if(that.$sel) {that.$sel.attr("tabindex", -1);}
that.$btn.focus();
}
});
@@ -203,6 +202,7 @@
}
if(wasClose) {
+ if (this.$sel) {this.$sel.attr("tabindex", -1);}
if(document.activeElement !== null && document.activeElement !== document && document.activeElement !== document.body) {
var $nw = this.listEnter();
$nw.attr("tabindex", 0);
@@ -214,7 +214,16 @@
btnOpenHandler: function() {
this.dialogToggle(300);
},
-outHandler: function() {
+focusoutHandler: function() {
+ var list = this.$list;
+ var that = this;
+ setTimeout(function() {
+ if (list.find(":focus").length == 0) {
+ that.dialogToggle(200);
+ }
+ }, 200);
+},
+mouseoutHandler: function() {
this.dialogToggle(200);
},
btnKeyFilter: function(e) {
@@ -241,6 +250,7 @@
if(p) {
$nw.attr("tabindex", 0);
$nw.focus();
+ if (this.$sel) {this.$sel.attr("tabindex", -1);}
this.$sel = $nw;
e.preventDefault();
e.stopPropagation();
@@ -267,6 +277,7 @@
return this.$list.children(":last-child").children(":first-child");
},
listExit: function() {
+ this.mouseoutHandler();
return this.$btn;
},
listEnter: function() {
More information about the Bf-docboard-svn
mailing list