Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[@mantine/spotlight] Search for the action item in the document or in ShadowDOMs #6400

Merged
merged 6 commits into from
Jun 28, 2024

Conversation

gruschis
Copy link
Contributor

Following up on my proposed fix on Discord, here's finally the PR.
The added method tries to find the Spotlight's action element in the document and in any potential ShadowDOM.

@gruschis gruschis requested a review from 2jordan3 June 18, 2024 08:16
@rtivital
Copy link
Member

Please fix errors in tests

@rtivital
Copy link
Member

It breaks the spotlight when escape key is pressed with the following error:

spotlight.store.ts:60 Uncaught (in promise) DOMException: Failed to execute 'querySelector' on 'Document': '#' is not a valid selector.
    at findElementByQuerySelector (http://localhost:2356/packages_mantine_spotlight_src_Spotlight_tsx-node_modules_tabler_icons-react_dist_esm_icons_I-f23c65.iframe.bundle.js:1802:26)
    at selectAction (http://localhost:2356/packages_mantine_spotlight_src_Spotlight_tsx-node_modules_tabler_icons-react_dist_esm_icons_I-f23c65.iframe.bundle.js:1823:25)
    at http://localhost:2356/packages_mantine_spotlight_src_Spotlight_tsx-node_modules_tabler_icons-react_dist_esm_icons_I-f23c65.iframe.bundle.js:1860:9

@rtivital
Copy link
Member

You can view the demo in the storybook – http://localhost:2356/?path=/story/spotlight--demo-usage

@gruschis
Copy link
Contributor Author

It breaks the spotlight when escape key is pressed

Since listId is empty when spotlight closes, only # gets passed. Now, it'll check if listId is a truthy value.

@rtivital rtivital merged commit 898ab91 into mantinedev:master Jun 28, 2024
1 check passed
@rtivital
Copy link
Member

Thanks!

davydkov added a commit to likec4/likec4 that referenced this pull request Jul 11, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@mantine/core](https://mantine.dev/)
([source](https://togithub.com/mantinedev/mantine/tree/HEAD/packages/@mantine/core))
| [`7.11.0` ->
`7.11.1`](https://renovatebot.com/diffs/npm/@mantine%2fcore/7.11.0/7.11.1)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@mantine%2fcore/7.11.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@mantine%2fcore/7.11.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@mantine%2fcore/7.11.0/7.11.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@mantine%2fcore/7.11.0/7.11.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [@mantine/core](https://mantine.dev/)
([source](https://togithub.com/mantinedev/mantine/tree/HEAD/packages/@mantine/core))
| [`^7.11.0` ->
`^7.11.1`](https://renovatebot.com/diffs/npm/@mantine%2fcore/7.11.0/7.11.1)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@mantine%2fcore/7.11.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@mantine%2fcore/7.11.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@mantine%2fcore/7.11.0/7.11.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@mantine%2fcore/7.11.0/7.11.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [@mantine/hooks](https://mantine.dev)
([source](https://togithub.com/mantinedev/mantine/tree/HEAD/packages/@mantine/hooks))
| [`7.11.0` ->
`7.11.1`](https://renovatebot.com/diffs/npm/@mantine%2fhooks/7.11.0/7.11.1)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@mantine%2fhooks/7.11.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@mantine%2fhooks/7.11.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@mantine%2fhooks/7.11.0/7.11.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@mantine%2fhooks/7.11.0/7.11.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [@mantine/hooks](https://mantine.dev)
([source](https://togithub.com/mantinedev/mantine/tree/HEAD/packages/@mantine/hooks))
| [`^7.11.0` ->
`^7.11.1`](https://renovatebot.com/diffs/npm/@mantine%2fhooks/7.11.0/7.11.1)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@mantine%2fhooks/7.11.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@mantine%2fhooks/7.11.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@mantine%2fhooks/7.11.0/7.11.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@mantine%2fhooks/7.11.0/7.11.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [@mantine/vanilla-extract](https://mantine.dev)
([source](https://togithub.com/mantinedev/mantine/tree/HEAD/packages/@mantine/vanilla-extract))
| [`7.11.0` ->
`7.11.1`](https://renovatebot.com/diffs/npm/@mantine%2fvanilla-extract/7.11.0/7.11.1)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@mantine%2fvanilla-extract/7.11.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@mantine%2fvanilla-extract/7.11.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@mantine%2fvanilla-extract/7.11.0/7.11.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@mantine%2fvanilla-extract/7.11.0/7.11.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>mantinedev/mantine (@&#8203;mantine/core)</summary>

###
[`v7.11.1`](https://togithub.com/mantinedev/mantine/releases/tag/7.11.1)

[Compare
Source](https://togithub.com/mantinedev/mantine/compare/7.11.0...7.11.1)

##### What's Changed

- `[@mantine/core]` Add option to display `nothingFoundMessage` when
data is empty in Select and MultiSelect components
([#&#8203;6477](https://togithub.com/mantinedev/mantine/issues/6477))
- `[@mantine/core]` Tooltip: Add `defaultOpened` prop support
([#&#8203;6466](https://togithub.com/mantinedev/mantine/issues/6466))
- `[@mantine/core]` PinInput: Fix incorrect rtl logic
([#&#8203;6382](https://togithub.com/mantinedev/mantine/issues/6382))
- `[@mantine/core]` Popover: Fix `floatingStrategy="fixed"` not having
`position:fixed` styles
([#&#8203;6419](https://togithub.com/mantinedev/mantine/issues/6419))
- `[@mantine/spotlight]` Fix spotlight not working correctly with shadow
DOM
([#&#8203;6400](https://togithub.com/mantinedev/mantine/issues/6400))
- `[@mantine/form]` Fix `onValuesChange` using stale values
([#&#8203;6392](https://togithub.com/mantinedev/mantine/issues/6392))
- `[@mantine/carousel]` Fix `onSlideChange` using stale props values
([#&#8203;6393](https://togithub.com/mantinedev/mantine/issues/6393))
- `[@mantine/charts]` Fix unexpected padding on the right side of the
chart in BarChart, AreaChart and LineChart components
([#&#8203;6467](https://togithub.com/mantinedev/mantine/issues/6467))
- `[@mantine/core]` Select: Fix `onChange` being called with the already
selected if it has been picked from the dropdown
([#&#8203;6468](https://togithub.com/mantinedev/mantine/issues/6468))
- `[@mantine/dates]` DatePickerInput: Fix `highlightToday` not working
([#&#8203;6471](https://togithub.com/mantinedev/mantine/issues/6471))
- `[@mantine/core]` NumberInput: Fix incorrect handling of numbers
larger than max safe integer on blur
([#&#8203;6407](https://togithub.com/mantinedev/mantine/issues/6407))
- `[@mantine/core]` Tooltip: Fix tooltip arrow being incompatible with
headless mode
([#&#8203;6458](https://togithub.com/mantinedev/mantine/issues/6458))
- `[@mantine/core]` ActionIcon: Fix loading styles inconsistency with
Button component
([#&#8203;6460](https://togithub.com/mantinedev/mantine/issues/6460))
- `[@mantine/charts]` PieChart: Fix key error for duplicated `name` data
([#&#8203;6067](https://togithub.com/mantinedev/mantine/issues/6067))
- `[@mantine/core]` Modal: Fix `removeScrollProps.ref` not being
compatible with React 19
([#&#8203;6446](https://togithub.com/mantinedev/mantine/issues/6446))
- `[@mantine/core]` TagsInput: Fix `selectFirstOptionOnChange` prop not
working
([#&#8203;6337](https://togithub.com/mantinedev/mantine/issues/6337))
- `[@mantine/hooks]` use-eye-dropper: Fix Opera being incorrectly
detected as a supported browser
([#&#8203;6307](https://togithub.com/mantinedev/mantine/issues/6307))
- `[@mantine/core]` Fix `:host` selector now working correctly in
`cssVariablesSelector` of MantineProvider
([#&#8203;6404](https://togithub.com/mantinedev/mantine/issues/6404))
- `[@mantine/core]` TagsInput: Fix `onChange` being called twice when
Enter key is pressed in some cases
([#&#8203;6416](https://togithub.com/mantinedev/mantine/issues/6416))
- `[@mantine/modals]` Fix Modal overrides type augmentation not working
with TypeScript 5.5
([#&#8203;6443](https://togithub.com/mantinedev/mantine/issues/6443))
- `[@mantine/core]` Tree: Fix `levelOffset` prop being added to the root
DOM element
([#&#8203;6461](https://togithub.com/mantinedev/mantine/issues/6461))

##### New Contributors

- [@&#8203;bsl-zcs](https://togithub.com/bsl-zcs) made their first
contribution in
[mantinedev/mantine#6461
- [@&#8203;florisdg](https://togithub.com/florisdg) made their first
contribution in
[mantinedev/mantine#6443
- [@&#8203;snlacks](https://togithub.com/snlacks) made their first
contribution in
[mantinedev/mantine#6425
- [@&#8203;lid0a](https://togithub.com/lid0a) made their first
contribution in
[mantinedev/mantine#6415
- [@&#8203;Knamer95](https://togithub.com/Knamer95) made their first
contribution in
[mantinedev/mantine#6416
- [@&#8203;yyytae0](https://togithub.com/yyytae0) made their first
contribution in
[mantinedev/mantine#6404
- [@&#8203;toanxyz](https://togithub.com/toanxyz) made their first
contribution in
[mantinedev/mantine#6388
- [@&#8203;viktorkasap](https://togithub.com/viktorkasap) made their
first contribution in
[mantinedev/mantine#6307
- [@&#8203;alexlapp](https://togithub.com/alexlapp) made their first
contribution in
[mantinedev/mantine#6337
- [@&#8203;brycefranzen](https://togithub.com/brycefranzen) made their
first contribution in
[mantinedev/mantine#6446
- [@&#8203;marcobiedermann](https://togithub.com/marcobiedermann) made
their first contribution in
[mantinedev/mantine#6442
- [@&#8203;mullwar](https://togithub.com/mullwar) made their first
contribution in
[mantinedev/mantine#6067
- [@&#8203;gruschis](https://togithub.com/gruschis) made their first
contribution in
[mantinedev/mantine#6400
- [@&#8203;jpranays](https://togithub.com/jpranays) made their first
contribution in
[mantinedev/mantine#6466

**Full Changelog**:
mantinedev/mantine@7.11.0...7.11.1

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these
updates again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/likec4/likec4).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MjEuOSIsInVwZGF0ZWRJblZlciI6IjM3LjQyMS45IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants