Focus nearby Remove button in storage manager when hitting Remove
The window shouldn't lose focus when you press Remove.main
parent
eee7179cf8
commit
12a90c6bb9
|
@ -45,7 +45,7 @@
|
|||
const $message = $(E("p")).appendTo($storage_manager.$main).html(
|
||||
"Any images you've saved to your computer with <b>File > Save</b> will not be affected."
|
||||
);
|
||||
$storage_manager.$Button("Close", () => {
|
||||
const $close = $storage_manager.$Button("Close", () => {
|
||||
$storage_manager.close();
|
||||
});
|
||||
|
||||
|
@ -63,6 +63,12 @@
|
|||
$(E("td")).append($remove).appendTo($tr);
|
||||
|
||||
$remove.on("click", () => {
|
||||
// Focus the next or previous row's remove button, or the close button if there are no more rows.
|
||||
// Try focusing controls in reverse order of priority, so the highest priority control gets focus.
|
||||
$close.focus();
|
||||
$tr.prev().find(".remove-button").focus();
|
||||
$tr.next().find(".remove-button").focus();
|
||||
|
||||
localStorage.removeItem(k);
|
||||
$tr.remove();
|
||||
if ($table.find("tr").length == 0) {
|
||||
|
|
Loading…
Reference in New Issue