lostcoords-ui 0.14.6 → 0.14.7

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: b9905bd1837028339420ab4601d23e1499a6a9ba355b694707fa79284dad63fd
4
- data.tar.gz: 7f53b12ddc748f8aa39d820af1a278b07d9cdcbafca0eef0392258352f3eacdf
3
+ metadata.gz: 8e59511fee6edfa9e200f7b2561e8937d9d17c3884690db48e153346031fb54b
4
+ data.tar.gz: af8f42618286ed51b91f7dfcfe9f97cbf8f44bf24472a1ca1e2bb5eea603a3e6
5
5
  SHA512:
6
- metadata.gz: 923ff077a975fd90c19daf1a186a1a334516dacb0351e89fb1094a13016b86068d21e0f3e5cabd52c70c72d5d3a3f58e97909dc6b299d3de2c0f950c394c4f5e
7
- data.tar.gz: 73ed37232a4ac32ecf122f81df0e039bc8b9040f6812a343fa79f25e214a90d2255c41ae35c08c577590c2d5f458fa35e836624f7a50c9d82719fa185bdec007
6
+ metadata.gz: 8867f7a32ba7c848d3d908eabdd3bb326ae482ff3856faba090fbc3db0999f2a25c50133f5ebd3a057e7bbd0e026a926f8198f02fd0733ebd7260e5b87947398
7
+ data.tar.gz: 0c7ebba325be9b795f36d5dbe6ec20ca6fc851fe09069c231c78218fa78c0402413312b31a5a6d7831768f45b4951df7b22e8df6c9bb4ed7f232ccec4d2221af
data/README.md CHANGED
@@ -170,6 +170,14 @@ Omit `only` to register every library controller. Unknown identifiers raise befo
170
170
  registered, and repeated calls on the same application keep later overrides, so register defaults
171
171
  before application overrides.
172
172
 
173
+ ## Changes in 0.14.7
174
+
175
+ Nothing needs an edit. Fixed:
176
+
177
+ - **Focus also returns when the host removes the dialog as it closes.** Such a caller unregisters before
178
+ the `close` event arrives, which is where 0.14.6 returned focus, so Safari still left it on the page.
179
+ Focus now settles when a closed dialog is unregistered.
180
+
173
181
  ## Changes in 0.14.6
174
182
 
175
183
  Nothing needs an edit. Fixed:
@@ -66,14 +66,12 @@ export function registerDialog(
66
66
  if (!inside) close(event)
67
67
  }
68
68
  // A dialog closed and shown again in the same task fires close while it is already open again.
69
- // By now the browser has handed focus back to what had it before the dialog opened, if
70
- // anything had.
71
69
  const unregisterOnClose = () => {
72
- if (dialog.open) return
73
- unregister()
74
- returnFocus(opener, dialog)
75
- settleFocus()
70
+ if (!dialog.open) unregister()
76
71
  }
72
+ // A closed dialog has handed focus back to what had it before it opened, if anything had. A
73
+ // caller that removes the dialog as it closes unregisters before the close event arrives, so
74
+ // focus settles here and not in that event.
77
75
  const unregister = () => {
78
76
  if (registrations.get(dialog) !== unregister) return
79
77
  registrations.delete(dialog)
@@ -81,6 +79,10 @@ export function registerDialog(
81
79
  dialog.removeEventListener("close", unregisterOnClose)
82
80
  dialog.removeEventListener("click", closeOnBackdrop)
83
81
  unregisterDismissable()
82
+ if (dialog.open) return
83
+
84
+ returnFocus(opener, dialog)
85
+ settleFocus()
84
86
  }
85
87
 
86
88
  registrations.set(dialog, unregister)
@@ -1,5 +1,5 @@
1
1
  module Lostcoords
2
2
  module Ui
3
- VERSION = "0.14.6"
3
+ VERSION = "0.14.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lostcoords-ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.6
4
+ version: 0.14.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lost Coordinates