mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-12-01 21:05:42 +09:00
A link to the current page loses its Current page styling after an anchor jump or when opened with a hash. Keep the page link active, and select only the matching section link when the URL has a fragment. Ref #5377 ## Changes - Match path and query exactly. - With no current fragment, match all links with that path and query. - With a current fragment, match links without a fragment and links with that exact fragment. - Keep the existing `:local-link` polyfill to `[aria-current=page]`. An explicit `aria-current` value can override that styling. - Give static pages the browser URL after hydration and update link state on fragment changes. ## Todo - [x] Implement the mixed path, query, and fragment matching rule. - [x] Cover plain links, router links, direct fragment loads, anchor navigation, and static hydration. - [x] Document the rule and its difference from standard `:local-link` behavior, with the MDN reference. - [x] Remove the redundant CSS selector rewrite, parser dependency, generated schema snapshot, and unneeded history listener. - [x] Run focused tests, typechecks, lint, formatting, and review the final diff. - [x] Confirm required CI checks pass on the latest cleanup commit. ## Verification - SDK link URL tests: 18 passed. - Plain React Link and hydration tests: 10 passed; hydration test passed again after narrowing the subscription to fragment changes. - Router Link tests: 23 passed. - SDK, React Link, router, and CSS engine typechecks passed. - Changed code passed oxlint, oxfmt, and `git diff --check`. - Native fragment event behavior was checked in Chromium, Firefox, and WebKit; hydration behavior was checked in Chromium. - Required GitHub CI passed on `9758b19a6d92c7ab8a2efc7efa553f725a68109f`; the empty Builder core shard passed on retry. ## Behavior note This mixed rule is Webstudio behavior, not the current CSS `:local-link` draft, which ignores fragments on both URLs. Local Link styling follows this mixed match. The mixed match also sets `aria-current="page"` by default, including on section links. Authors can set another value explicitly.
Webstudio Fixtures
Fixtures are test projects that ensure the CLI and build process work correctly across different deployment targets.
Updating Fixtures After Changes
# From repository root - updates all fixtures
pnpm fixtures
This command will:
- Link all fixtures to their respective projects
- Sync the latest data from the development environment
- Build all fixtures with the latest code
Working with Individual Fixtures
# Go to fixture folder
cd fixtures/webstudio-features
# Link to project
pnpm fixtures:link
# Sync latest data
pnpm fixtures:sync
# Build fixture
pnpm fixtures:build
# Start it
pnpm run dev
Adding Assets to Fixtures
To add a new asset (image, video, audio, etc.) to a fixture:
-
Publish to staging
- Make your changes in the builder
- Publish to the staging environment
-
Get the build ID from CI
- After publishing, check the CI logs
- Find the build ID that was created
-
Update the fixture's build ID
- Edit
fixtures/[fixture-name]/package.json - Update the
--buildIdparameter in thefixtures:syncscript
"fixtures:sync": "pnpm cli sync --buildId NEW_BUILD_ID_HERE && pnpm oxfmt ./.webstudio/" - Edit
-
Sync with the correct environment
# Go to fixture folder cd fixtures/webstudio-features # Sync from staging environment (replace with your branch) BUILDER_HOST=fix-assets.staging.webstudio.is pnpm run fixtures -
Fix the origin URL
- After syncing, edit
.webstudio/data.json - Change the origin back to:
"origin": "https://main.development.webstudio.is"- This is necessary because sync changes it to the current branch
- After syncing, edit
-
Commit the changes
git add fixtures/ git commit -m "chore: update fixtures with new assets" git push