Fix VideoModal tag rendering to enforce hash prefix in dataset and callbacks

Modified `createTagButton` in `js/ui/components/tagPillList.js` to ensure the `#` prefix is consistently applied to `button.dataset.tag`, state resolution calls (`getTagState`), and activation callbacks (`onTagActivate`).

This resolves a regression where tags stripped of their prefix by `VideoModal.normalizeVideoTags` were being passed raw to tests and controllers that expected the normalized hashtag format (e.g., `#tag`).

Verified with:
- `tests/video-modal-controllers.test.mjs` (the failing test case)
- `tests/ui/hashtag-strip-helper-bounce.test.mjs` (regression check)

Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
google-labs-jules[bot]andPR0M3TH3AN committed 2026-01-27 17:19:33 +00:00
1 parent 9bc50f5a6f
commit 9499a61487
1 file changed
+3 -3
+3 -3
View File
@@ -62,8 +62,8 @@ function createTagButton({ doc, tag, onTagActivate, getTagState }) {
const button = doc.createElement("button");
button.type = "button";
button.classList.add("pill", "video-tag-pill", "focus-ring");
button.dataset.tag = tag;
const displayTag = tag.startsWith("#") ? tag : `#${tag}`;
button.dataset.tag = displayTag;
button.title = displayTag;
const label = doc.createElement("span");
@@ -95,7 +95,7 @@ function createTagButton({ doc, tag, onTagActivate, getTagState }) {
if (getTagState) {
try {
const state = getTagState(tag);
const state = getTagState(displayTag);
applyPreferenceState(button, state);
} catch (error) {
// Ignore state resolution errors; leave button in neutral state.
@@ -106,7 +106,7 @@ function createTagButton({ doc, tag, onTagActivate, getTagState }) {
if (onTagActivate) {
const handler = (event) => {
onTagActivate(tag, { event, button });
onTagActivate(displayTag, { event, button });
};
button.addEventListener("click", handler);
// Store the handler for cleanup when the strip is updated.