Remove a favourite by pointing at its tile - #85
Merged
Merged
Conversation
Issue 80's reporter, on build-42ed14f: two tiles both reading instagram.com, both kept by typing, opening different pages, and no way to get rid of either — "removing instagram.com or instagram.com/reels didn't removed them, reopening also didn't helped and pressing 8 always say open a page first". The message he hit was mine, from an hour earlier, and it was correct and useless advice. The hole behind it had been there since favourites existed and only keeping an address by typing it made it reachable: removal required knowing the string. Being on the page and pressing 8 worked because the engine handed us the exact address; anything else meant typing it back. And the start screen shows a host with the www. stripped, plus a title — neither of which is what the favourite is stored as. Two kept addresses on one site render as the same two lines, and the thing you would have to type is nowhere on the screen. So 8 on the start screen now removes the tile the pointer is on. PageScript.linkAt() climbs from the hit-test to the nearest anchor and returns its href, which for a tile is the stored address exactly, because HomePage wrote it there. Pointing at the thing you want gone cannot be spelled wrong, and the pointer already knew how to hit-test. A recent tile gets kept instead, which is the same key doing what it does everywhere else. Two supporting changes. A kept address is named by its address (Urls.Readable) rather than by the bare host, which is why his two tiles read identically. And SameKey folds a leading www. as well as the trailing slash — the two parts of an address a person neither sees nor types — so typing back exactly what the tile shows finds the favourite it names. linkAt verified in desktop chromium against two look-alike tiles and a non-link; cdpharness re-run for the frame path; startpage covers the www. fold and its limits.
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.
His report on
build-42ed14f: two tiles both readinginstagram.com, both kept by typing, opening different pages, and no way to remove either — "removing instagram.com or instagram.com/reels didn't removed them, reopening also didn't helped and pressing 8 always say open a page first".That message was mine, from an hour earlier. It was correct, and it was useless advice.
The hole
It had been there since favourites existed, and only keeping an address by typing it made it reachable: removal required knowing the string. Being on the page and pressing
8worked because the engine handed us the exact address. Anything else meant typing it back — and what the start screen shows is a host with thewww.stripped plus a title, neither of which is what the favourite is stored as. Two kept addresses on one site therefore render as the same two lines, and the thing you would have to type is nowhere on the screen.Adding was one press. Removing was a guess.
Three changes, and the first is the one that matters
8on the start screen removes the tile the pointer is on.PageScript.linkAt()climbs from the hit-test to the nearest anchor and returns itshref— for a tile that is the stored address exactly, becauseHomePagewrote it there. Pointing at the thing you want gone is the one gesture that cannot be spelled wrong, and the pointer already knew how to hit-test; the whole addition is fifteen lines of script and a bridge message. A recent tile gets kept instead, which is the same key doing what it does everywhere else.SiteRules.KeyFor— the bare host — which is exactly why his two tiles read identically.Urls.Readabledrops the scheme and a trailing slash and keeps the rest.SameKeyfolds a leadingwww.as well as the trailing slash: the two parts of an address a person neither sees nor types. Without it, typing back exactly what the tile shows still missed the favourite that tile names.The rule this leaves behind, in INTERNALS: anything the app will act on by name must be displayed under that name, or be reachable without one. Favourites were neither.
Checks
linkAtverified in desktop chromium against a page carrying his exact case — two look-alike tiles differing only in path, plus a non-link. Returnshttps://www.instagram.com/reel,https://www.instagram.com/reels, and"".tools/cdpharness/run.sh— green. Required:PageScriptchanged, and a syntax error there kills the pointer on every build.tools/startpage/run.sh— thewww.fold, that it is only a whole label at the front of the host, and that/reelis still not/reels. Green.tools/siterules/run.shgreen;./build.sh allfive packages, 0 warnings.