@skeletonlabs/skeleton 2.10.3 → 2.10.4

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.
@@ -143,6 +143,10 @@ export function popup(triggerNode, args) {
143
143
  function toggle() {
144
144
  popupState.open === false ? open() : close();
145
145
  }
146
+ function handleMouseUp(event) {
147
+ if (!triggerNode.contains(event.target))
148
+ close();
149
+ }
146
150
  function onWindowClick(event) {
147
151
  // Return if the popup is not yet open
148
152
  if (popupState.open === false)
@@ -152,7 +156,10 @@ export function popup(triggerNode, args) {
152
156
  return;
153
157
  // If click it outside the popup
154
158
  if (elemPopup && elemPopup.contains(event.target) === false) {
155
- close();
159
+ const selection = window.getSelection();
160
+ if (selection && selection.toString().length == 0) {
161
+ close();
162
+ }
156
163
  return;
157
164
  }
158
165
  // Handle Close Query State
@@ -195,6 +202,7 @@ export function popup(triggerNode, args) {
195
202
  switch (args.event) {
196
203
  case 'click':
197
204
  triggerNode.addEventListener('click', toggle, true);
205
+ window.addEventListener('mouseup', handleMouseUp, true);
198
206
  window.addEventListener('click', onWindowClick, true);
199
207
  break;
200
208
  case 'hover':
@@ -234,6 +242,7 @@ export function popup(triggerNode, args) {
234
242
  triggerNode.removeEventListener('blur', () => close(), true);
235
243
  // Window Events
236
244
  window.removeEventListener('click', onWindowClick, true);
245
+ window.removeEventListener('mouseup', handleMouseUp, true);
237
246
  window.removeEventListener('keydown', onWindowKeyDown, true);
238
247
  }
239
248
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skeletonlabs/skeleton",
3
- "version": "2.10.3",
3
+ "version": "2.10.4",
4
4
  "description": "A SvelteKit component library.",
5
5
  "author": "endigo9740 <chris@skeletonlabs.dev>",
6
6
  "repository": {