Bug 235471 - :active selector doesn’t display
Summary: :active selector doesn’t display
Status: RESOLVED DUPLICATE of bug 22261
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: Safari 15
Hardware: iPhone / iPad iOS 15
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-01-22 00:24 PST by Reece A
Modified: 2022-01-25 10:37 PST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Reece A 2022-01-22 00:24:33 PST
I have recently updated to iPadOS 15 and went to my website…
When you click on a link it should change colour but since I have updated it will not. I have a 2020 iPad Pro on iPadOS15.

I used the :active selector 

a:active {
   color: brown;
}
Comment 1 Alexey Proskuryakov 2022-01-23 17:43:01 PST
Could you please provide a link to your website, or a self contained test case? The active selector works in WebKit in general, e.g. I see it working here in Bugzilla.

Are you tapping, or using a Magic Keyboard trackpad? As tapping and holding immediately starts a transition to preview, avoiding :active seems like correct behavior in that case (and matches whet I observe).
Comment 2 Reece A 2022-01-24 10:42:39 PST
I am using the Magic Keyboard Trackpad. Here is the sandbox:
https://codepen.io/reeceatkinson/pen/PoOYdom
Comment 3 Alexey Proskuryakov 2022-01-25 09:56:23 PST
Thank you! I can reproduce on a Mac too - works as expected in Chrome, but not in Safari.

In the codepen test, the purple color comes from "focus", not from "active". That's longstanding expected behavior, please see bug 22261 for discussion.

.sidebar li a:focus {
  background: #ccccf0;
}

The original report here is about :active though. Do you have a test with that? Also, did that work before iPadOS 15? If something changed, that would be an indication that we could be looking at something other than bug 22261.
Comment 4 Reece A 2022-01-25 10:09:34 PST
So how would I make the background turn purple when it has been clicked?
Comment 5 Alexey Proskuryakov 2022-01-25 10:20:16 PST
The bit of code that you posted originally is the right way to achieve such behavior. If it doesn't work, please provide a complete test case - the one that you provided on codepen is different.
Comment 6 Reece A 2022-01-25 10:22:45 PST
I would however it is the exact same code from my production environment.
Comment 7 Alexey Proskuryakov 2022-01-25 10:37:06 PST
I see. Please switch to a:active, a:focus will not work for this purpose.

*** This bug has been marked as a duplicate of bug 22261 ***