Skip to content

Commit

Permalink
fix(cosmoz-tabs): delays initial setTabs to microtask
Browse files Browse the repository at this point in the history
In Firefox the `slotchange` fires a bit too soon ...
  • Loading branch information
megheaiulian authored and cristinecula committed Sep 25, 2020
1 parent 51ec09c commit 2d8acd5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/use-tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const useTabSelectedEffect = (host, selectedTab) => {
return {
tabs,
selectedTab,
onSlot: useCallback(({ target }) => setTabs(target.assignedElements().filter(el => el.matches('cosmoz-tab'))), []),
onSlot: useCallback(({ target }) => queueMicrotask(() => setTabs(target.assignedElements().filter(el => el.matches('cosmoz-tab')))), []),
onSelect: useCallback(e => {
if (e.button !== 0 || e.metaKey || e.ctrlKey) {
return;
Expand Down

0 comments on commit 2d8acd5

Please sign in to comment.