@surstromming/dropdown-menu 0.1.1 → 0.1.2

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @surstromming/dropdown-menu
2
2
 
3
+ ## 0.1.2 — 2026-07-26
4
+
5
+ ### Fixed
6
+
7
+ - **Closing a menu no longer scrolls its trigger back into view.** Focus still
8
+ returns to the trigger, but with `preventScroll` now. What usually closes a
9
+ menu is a press somewhere else, and the return runs before that press has
10
+ focused what it hit — so in a long list, opening a menu on the first row,
11
+ scrolling well past it and pressing another row's trigger yanked the page
12
+ back to the first row. The press places focus itself a moment later, so only
13
+ the scroll is given up; Escape and selecting an item are unchanged, and a
14
+ trigger reached by keyboard is on screen to begin with.
15
+
16
+ No API change.
17
+
3
18
  ## 0.1.1 — 2026-07-26
4
19
 
5
20
  ### Fixed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@surstromming/dropdown-menu",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "A menu of actions anchored to a trigger.",
5
5
  "license": "MIT",
6
6
  "author": "Evgeniy Mnatsakanov <evgeniy.mnatsakanov@gmail.com>",
@@ -123,7 +123,12 @@ watch(open, async (isOpen) => {
123
123
  await nextTick()
124
124
  focusEdge('start')
125
125
  } else if (menu.value?.contains(document.activeElement)) {
126
- trigger?.focus()
126
+ // `preventScroll`, because what usually closes a menu is a press somewhere
127
+ // else, and this runs before that press has focused what it hit. Scrolling
128
+ // the trigger back into view drags the page to wherever its row happens to
129
+ // be — in a long list, nowhere near what the reader is looking at. The
130
+ // press then puts focus where it belongs, so only the scroll is given up.
131
+ trigger?.focus({ preventScroll: true })
127
132
  }
128
133
  })
129
134