[bug] fix link focus on edit or remove

This commit is contained in:
zombieFox 2019-06-14 20:15:10 +01:00
parent 37a7005c42
commit 16e90f5289
3 changed files with 35 additions and 20 deletions

View File

@ -54,6 +54,7 @@
.link-item:hover { .link-item:hover {
transform: scale(1.05); transform: scale(1.05);
z-index: 2; z-index: 2;
outline: 0;
} }
.link-item:active { .link-item:active {

View File

@ -4,8 +4,17 @@ var link = (function() {
var _returnToPreviousFocusLink = function() { var _returnToPreviousFocusLink = function() {
if (_previousFocusLink != null) { if (_previousFocusLink != null) {
helper.eA(".link-panel-back")[_previousFocusLink].querySelectorAll(".link-control-item")[0].focus(); var linkPanelFront = helper.eA(".link-panel-front");
_previousFocusLink = null if (linkPanelFront.length > 0) {
if (_previousFocusLink >= 0) {
linkPanelFront[_previousFocusLink].focus();
} else {
linkPanelFront[0].focus();
};
} else {
helper.e("body").focus();
};
_previousFocusLink = null;
}; };
}; };
@ -129,11 +138,26 @@ var link = (function() {
}; };
var remove = function(bookmarkData) { var remove = function(bookmarkData) {
bookmarks.remove(bookmarkData); modal.render({
_checkCount(); heading: "Remove " + bookmarkData.name + " bookmark",
data.save(); content: "Are you sure you want to remove this bookmark? This can not be undone.",
clear(); successAction: function() {
render.item.all(); _previousFocusLink = _previousFocusLink - 1;
bookmarks.remove(bookmarkData);
_checkCount();
data.save();
clear();
render.item.all();
control.dependents();
control.render();
_returnToPreviousFocusLink();
},
cancelAction: function() {
_returnToPreviousFocusLink();
},
actionText: "Remove",
size: "small"
});
}; };
var _checkCount = function() { var _checkCount = function() {
@ -438,18 +462,8 @@ var link = (function() {
edit(data); edit(data);
}, false); }, false);
linkRemove.addEventListener("click", function() { linkRemove.addEventListener("click", function() {
modal.render({ _previousFocusLink = index;
heading: "Remove " + data.name + " bookmark", remove(data);
content: "Are you sure you want to remove this bookmark? This can not be undone.",
successAction: function() {
remove(data);
control.dependents();
control.render();
},
actionText: "Remove",
cancelText: "Cancel",
size: "small"
});
}, false); }, false);
return linkItem; return linkItem;

View File

@ -1,7 +1,7 @@
var version = (function() { var version = (function() {
// version is normally bumped when the state needs changing or any new functionality is added // version is normally bumped when the state needs changing or any new functionality is added
var current = "3.10.2"; var current = "3.10.3";
var compare = function(a, b) { var compare = function(a, b) {
var pa = a.split("."); var pa = a.split(".");