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: 88eacfb8b1c5006e209a9152bda3f464c54675d0460388624aefdae0c106e838
4
- data.tar.gz: 34abe3d1f0f3c3cb0304114543bc1649c6c87a47fa7faa67577f37c1cd041bee
3
+ metadata.gz: f116e4650e408eb4c0157a1ecdfe528025dcc1fe56e48d56d5d878e6aeb76625
4
+ data.tar.gz: 989ea2f307e753b10c68e257b8206b7b3fe8fef47b1d3eeace916e1fc50f8306
5
5
  SHA512:
6
- metadata.gz: 1910ed15f034f2c343a29e5f2060ad35f868f6cc6a66619e43f21127304bbeb1eef3008a7490d584e3efa2c05964344d5eda6815b2ae0628e4d1a271227df094
7
- data.tar.gz: 62cb48444c13a8c2c4812a3e065aff880b87646620166e92f7c21e0f6fb05bf3c0032fa82df423ce6e536b7c34cd1826b5dcc3e21cbc2cec4146b5ac1bd504a7
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;
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsMarkup
4
- VERSION = "1.4.4"
4
+ VERSION = "1.4.5"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-markup
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.4
4
+ version: 1.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - InventList