DeanH
DeanH

Reputation: 523

Using CSS as a selector in jQuery

Trying to overcome an issue with Mobile Safari. I have the following script that changes the class of the container and makes things inside it actionable when someone focuses inside of it:

$(".axxs-accordion .a-section.collapsed").on("focusin", function () {
    $(this).removeClass("collapsed").addClass("expanded");
    $(this).find('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable]').removeAttr("inert","");
  });

But apparently, that doesn't work on Mobile Safari. According to the article below, you have to use ":focus-visible" instead:

https://itnext.io/fixing-focus-for-safari-b5916fef1064

So given the above script, how do I edit it so that it includes that workaround?

Upvotes: 0

Views: 25

Answers (0)

Related Questions