rails-markup 1.4.4 → 1.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f116e4650e408eb4c0157a1ecdfe528025dcc1fe56e48d56d5d878e6aeb76625
|
|
4
|
+
data.tar.gz: 989ea2f307e753b10c68e257b8206b7b3fe8fef47b1d3eeace916e1fc50f8306
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dbcf8ce0f1c775122d1b58440dd648c7e02f22c63f25a0817d514e4951078ee283d859d3c7ac6ee5da37695feaaa756411d368b450a9f14be09050f6a99bf14f
|
|
7
|
+
data.tar.gz: 4b2d4640b67a39c5e8ce41a99481afe6cf153112657919d9e2b3160df732c319fb34ecbbd458db32974bdb545b68d17a4c3ab04dcc62095b04bcb58f9a17a480
|
|
@@ -152,6 +152,11 @@
|
|
|
152
152
|
_closeMenu(menu, restoreFocus = false) {
|
|
153
153
|
const list = this._menuList(menu);
|
|
154
154
|
const btn = menu.querySelector(".rm-menu-btn");
|
|
155
|
+
// If keyboard focus is inside the list we're about to move/hide, it would
|
|
156
|
+
// otherwise fall to <body>. Return it to the trigger so involuntary closes
|
|
157
|
+
// (scroll/resize/rebuild) and Tab keep a deterministic focus target — Tab
|
|
158
|
+
// then progresses naturally from the trigger.
|
|
159
|
+
const listHadFocus = !!(list && list.contains(document.activeElement));
|
|
155
160
|
if (list) {
|
|
156
161
|
list.classList.remove("rm-menu-open");
|
|
157
162
|
["position", "top", "bottom", "left", "right", "minWidth", "maxHeight", "overflowY", "pointerEvents"]
|
|
@@ -167,7 +172,7 @@
|
|
|
167
172
|
delete list._rmMenuPortalOrigin;
|
|
168
173
|
}
|
|
169
174
|
if (btn) btn.setAttribute("aria-expanded", "false");
|
|
170
|
-
if (restoreFocus) btn?.focus();
|
|
175
|
+
if (restoreFocus || listHadFocus) btn?.focus();
|
|
171
176
|
},
|
|
172
177
|
_closeAllMenus() {
|
|
173
178
|
if (!this.root) return;
|
data/lib/rails_markup/version.rb
CHANGED