Bug 225609

Summary: Reader mode is removing some headings when they are links
Product: WebKit Reporter: Barry Pollard <barry>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED MOVED    
Severity: Normal CC: ap, bfulgham, ik, simon.fraser, zalan
Priority: P2 Keywords: InRadar
Version: Safari 14   
Hardware: All   
OS: Unspecified   

Description Barry Pollard 2021-05-10 13:34:27 PDT
As discussed in this blog post: https://www.leereamsnyder.com/blog/making-headings-with-links-show-up-in-safari-reader
And demonstrated in this demo page: https://www.tunetheweb.com/experiments/heading-links/
Safari Reader Mode (MacOS BigSur 11.3.1 and iOS 14.5.1) has started hiding headers using the following pattern:

<a href="heading3"><h2 id="heading3">Heading 3</h2></a>

This is a popular pattern used by the links of MDN and the Web Almanac, and when I initially implemented this in in the Web Almanac two years ago I tested this and it did show them (I have a screenshot if you link, but only for Apple Watch, which seems to follow the same heuristics as reader mode and is also broken now).

Weirdly, when there is no paragraph above it, it sometimes leaves the heading in place (but removes the link), but mostly it just removes the heading completely.

The reverse works - and even retains the fact it's a link (though only in MacOS and not in Safari Technology Preview):

<h2 id="heading3"><a href="heading3">Heading 3</a></h2>

Adding a pointless span, returns the heading (though not as a link):

<a href="heading3"><h2 id="heading3"><span>Heading 3</span></h2></a>

Removing a heading completely ruins the reading flow of a document.
Comment 1 Alexey Proskuryakov 2021-05-10 14:34:04 PDT
Safari Reader Mode is a Safari feature. Could you please report this via https://feedbackassistant.apple.com for Apple engineers to take a look? I could move it myself too, but then you wouldn't be notified of updates or questions that Safari developers might have.
Comment 2 Barry Pollard 2021-05-10 14:47:45 PDT
Thanks for pointing me in the right direction.

Raised: FB9101668 (Safari Reader is removing some headers)

Though presume that's personal to me rather than a public bug tracker like this one.
Comment 3 Simon Fraser (smfr) 2021-05-11 10:53:32 PDT
<rdar://77789748>
Comment 4 Alexey Proskuryakov 2021-05-11 11:51:56 PDT
Thank you, the ID is helpful.

Looks like it reproduces with older releases too, can you confirm if this indeed only started happening with the latest releases for you?
Comment 5 Barry Pollard 2021-05-11 13:17:08 PDT
I've done some more digging and I don't think this ever worked properly :-(

First some version info:

The blog post in my initial comment says it's broker for them in /Safari 14.0.3 on MacOS 11.2.3.

I'm on 14.1 on 11.3.1.

I dug up an old iPad which is stuck on iOS 12 (12.5.2 to be precise running Safari 12.1) and oddly it's broken there too?!?

So I went back and dug through my code and looks like I only added the heading links 1 year ago to my site, and my example of it "working" was from before then, so it must have been a plain header :-(

So apologies for that bad information. However I still think this should be fixed.
Comment 6 ik 2023-10-03 00:17:52 PDT
This still isn't fixed in Safari 17.
Can someone please ping the appropriate people/team? The Feedback Assistant is a black hole...

(it took yrs to fix the "Untitled" back button for PWA's, for example)

Thanks!
Comment 7 Alexey Proskuryakov 2023-10-03 08:34:27 PDT
Please share your feedback assistant IDs if you filed your own, to help the responsible engineers relate all relevant reports, and to accurately assess the priority.