Repository navigation
Conversation
update() only skipped setting the title while no-title was present, so a title written by an earlier render stayed on the element. Adding no-title later (or setting noTitle = true) left the title in place, and it went stale when datetime changed. The README says no-title removes the title. Remove the title attribute in update() when no-title is present. A custom title is still kept, since that branch only runs for generated titles.
Copilot stopped reviewing on behalf of
kwy404 due to an error
November 9, 2026 22:21
This branch has not been deployed
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.
The README says adding
no-titleremoves thetitleattribute, but that only works ifno-titleis there before the first render. If it is added later, the title from the earlier render stays:The leftover title also goes stale: if
datetimechanges whileno-titleis set, the element keeps the title of the old date.update()only skipped setting the title whennoTitlewas true, it never removed one that was already there. The fix removes thetitleattribute inupdate()whenno-titleis present. This is inside the!this.#customTitlebranch, so a custom title is still kept, as before. Removingno-titlesets the generated title again, same as before.One behavior change to note: an element rendered with both
no-titleand atitlethat is exactly the generated title (for example the same string rendered by the server) now has that title removed, because it cannot be told apart from a generated one. A different custom title is not touched.After this change, an element that gets
no-titlelater firesrelative-time-updatedthe same way as one that hadno-titlefrom the start: on each update, withnewTitleset to the computed title andoldTitleempty. Removing the title itself does not fire an event, because the computed title did not change.Tests: added tests for adding
no-titleafter render (fails before the change, passes after), keeping a custom title whenno-titleis added, and getting the title back whenno-titleis removed. I ran the full suite (web-test-runner, Chromium) andnpm run lint(tsc --noEmitand eslint). My machine's locale is not English, so I ran the suite with the browser context locale set toen-US(as in CI): 667 passed on this branch, 664 on main. With the unmodified config the same 133 locale-dependent tests fail on both main and this branch.