Filter comments toggle, X on phones, and m.youtube.com - #3
Merged
Merged
Conversation
Filter comments, off by default. Replies under a post are left alone unless the reader asks for them to be judged; the timeline is filtered either way, and the opened post and its ancestors always show. Off is absolute, like a bypassed thread: blocked authors in replies show too. The "Show all comments in this thread" control only appears while comments are filtered, since otherwise there is nothing for it to switch off. At phone widths X shows the post menu as a bottom sheet (sheetDialog) with no menu role around it and its own Cancel button last. Sharp now recognises it and places its rows above Cancel. The post is still identified by the engagements link, which X's other sheets do not carry, so they stay untouched. A sheet may ignore Escape, so if it is still open a frame after an action, its backdrop is tapped to close it. Where a thread page has no inline reply box, the thread control goes at the top of the replies, inside the first reply's cell so X still measures it. Structure for the sheet and thread fixtures comes from a Kiwi capture. Not yet checked on a device: tapping a row, the sheet's scroll, and the reply fallback.
The thread control's phone fallback stopped at the empty cell X places right after the opened post, so on layouts without an inline reply box the button never appeared. Empty cells are now stepped over on the way to the first reply. Greyscale moves out of the filtering tabs into a Misc tab of its own, for X and for YouTube. The Filter comments toggle keeps only its short description. The thread button, when on, now says what it is doing rather than what tapping it again would do: "Showing all comments in this thread".
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (19)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
The YouTube adapter never looked at the page: it sets attributes on <html> and the stylesheet decides what they mean. So the mobile site cost selectors rather than code, plus the hostname in the five places that list where Sharp runs — the manifest's permissions and matches, the content-script dispatcher, the worker's trusted senders, and the popup's site detection and origin list. Mobile serves `ytm-` Polymer elements where the desktop site serves `ytd-`, and puts navigation in a bar along the bottom rather than a sidebar. The newer `*-view-model` elements and `yt*ViewModel` classes are shared and were already covered. A selector matching nothing on the site in front of it costs nothing, so each feature's desktop and mobile selectors sit together. The origin list and the manifest are now checked against each other in both directions. A site injected into but not listed is a content script that never runs on Firefox, where host permissions are granted one origin at a time, and the popup would have no way to ask for it. Hostnames are still matched exactly, so music.youtube.com and a lookalike like m.youtube.com.evil.test start nothing. That is now tested. The mobile selectors are written from the shape of the mobile site, not from a session against it; they want checking on a real device before release.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Comment filtering becomes opt-in, Sharp's X controls now work at phone widths, and the YouTube rules apply on
m.youtube.com. Tested on Kiwi (Android).Filter comments
A new toggle under X › Filtering, off by default.
The in-thread button only appears while comments are filtered, since otherwise there's nothing for it to switch off. When on, it now describes the current state ("✓ Showing all comments in this thread") instead of the next action ("Filter comments in this thread").
X on phones
Both fixes come from DOM captures on Kiwi, which are the fixtures for the new tests.
⋯ menu. At phone width X shows the post menu as a bottom sheet (
[data-testid="sheetDialog"]) instead of a dropdown, with norole="menu"around it and a Cancel button last. Sharp didn't recognise it, so "Never filter / Always hide / Hide posts like this" never appeared. Now:Thread button. Phone thread pages have no inline reply box to sit above. The fallback places the button at the top of the replies, inside the first reply's cell so X still measures it. It first has to skip the empty cell X places right after the opened post; the previous fallback stopped there, which is why the button didn't appear.
YouTube on phones
The YouTube rules now apply on
m.youtube.comas well aswww.youtube.com. Sharp doesn't read or change YouTube's page logic; it sets attributes on the page and a stylesheet does the hiding. So supporting the mobile site meant adding its hostname and some CSS selectors:ytm-elements, alongside the desktopytd-ones. That includes the Shorts entry in the bottom tab bar.music.youtube.com,studio.youtube.comand lookalikes such asm.youtube.com.evil.teststart nothing.The mobile selectors haven't been checked against every page yet. Hidden thumbnails are the most layout-dependent rule.
Popup
Testing
bun run checkpasses: types, 83 tests, formatting, and both Chrome and Firefox builds.