Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit 16e90f5

Browse files
committed
[bug] fix link focus on edit or remove
1 parent 37a7005 commit 16e90f5

3 files changed

Lines changed: 35 additions & 20 deletions

File tree

css/link.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
.link-item:hover {
5555
transform: scale(1.05);
5656
z-index: 2;
57+
outline: 0;
5758
}
5859

5960
.link-item:active {

js/link.js

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,17 @@ var link = (function() {
44

55
var _returnToPreviousFocusLink = function() {
66
if (_previousFocusLink != null) {
7-
helper.eA(".link-panel-back")[_previousFocusLink].querySelectorAll(".link-control-item")[0].focus();
8-
_previousFocusLink = null
7+
var linkPanelFront = helper.eA(".link-panel-front");
8+
if (linkPanelFront.length > 0) {
9+
if (_previousFocusLink >= 0) {
10+
linkPanelFront[_previousFocusLink].focus();
11+
} else {
12+
linkPanelFront[0].focus();
13+
};
14+
} else {
15+
helper.e("body").focus();
16+
};
17+
_previousFocusLink = null;
918
};
1019
};
1120

@@ -129,11 +138,26 @@ var link = (function() {
129138
};
130139

131140
var remove = function(bookmarkData) {
132-
bookmarks.remove(bookmarkData);
133-
_checkCount();
134-
data.save();
135-
clear();
136-
render.item.all();
141+
modal.render({
142+
heading: "Remove " + bookmarkData.name + " bookmark",
143+
content: "Are you sure you want to remove this bookmark? This can not be undone.",
144+
successAction: function() {
145+
_previousFocusLink = _previousFocusLink - 1;
146+
bookmarks.remove(bookmarkData);
147+
_checkCount();
148+
data.save();
149+
clear();
150+
render.item.all();
151+
control.dependents();
152+
control.render();
153+
_returnToPreviousFocusLink();
154+
},
155+
cancelAction: function() {
156+
_returnToPreviousFocusLink();
157+
},
158+
actionText: "Remove",
159+
size: "small"
160+
});
137161
};
138162

139163
var _checkCount = function() {
@@ -438,18 +462,8 @@ var link = (function() {
438462
edit(data);
439463
}, false);
440464
linkRemove.addEventListener("click", function() {
441-
modal.render({
442-
heading: "Remove " + data.name + " bookmark",
443-
content: "Are you sure you want to remove this bookmark? This can not be undone.",
444-
successAction: function() {
445-
remove(data);
446-
control.dependents();
447-
control.render();
448-
},
449-
actionText: "Remove",
450-
cancelText: "Cancel",
451-
size: "small"
452-
});
465+
_previousFocusLink = index;
466+
remove(data);
453467
}, false);
454468

455469
return linkItem;

js/version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var version = (function() {
22

33
// version is normally bumped when the state needs changing or any new functionality is added
4-
var current = "3.10.2";
4+
var current = "3.10.3";
55

66
var compare = function(a, b) {
77
var pa = a.split(".");

0 commit comments

Comments
 (0)