theKashey / aria-hidden

🗣Cast aria-hidden to everything, except...

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Export `applyAttributeToOthers` function

atomiks opened this issue · comments

Hello again 😄

I'd like to leverage the DOM walking logic of this lib, but without marking anything with inert or aria-hidden in certain cases. The particular case I'm interested in is a non-modal popover, which won't have aria-hidden or inert applied.

Anything rendered after the popover opened should be considered a third-party extension to prevent "outside press" logic from running when clicking on them.

So I can do:

const undo = others(node, '[data-my-identifier]');

// on outside press,
// if the popover doesn't contain the target AND it has
// our marker
if (e.target.closest('[data-my-identifier]')) {
  // then we know it's not a third-party popup/toast that got injected
  // after it opened
  closePopover();
  undo();
}

https://twitter.com/diegohaz/status/1671928841445556231

Is this something that makes sense?

const applyAttributeToOthers = (

I think that is possible, but will require a little internal refactoring to un-globalize "counters".
More importantly - move functionality to another library, as this one has a very specific "name" and exposing unrelated functionality is just a bad smell.

commented

This issue has been marked as "stale" because there has been no activity for 2 months. If you have any new information or would like to continue the discussion, please feel free to do so. If this issue got buried among other tasks, maybe this message will reignite the conversation. Otherwise, this issue will be closed in 7 days. Thank you for your contributions so far.