adobe / adobe/aem-sidekick

[env-switcher] Persist hash when switching environments; carry text selection into DA editor

Open
#889 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
4
Forks
11
Avg merge
1d 5h
Merged PRs (30d)
7

Description

## Problem
When switching between environments via the env-switcher (and the edit plugin),
the position within the document is not carried over:

- **Rendered environments** (preview, live, dev, review, prod): the URL
`#anchor` is not consistently persisted, so the target loads at the top of
the page instead of at the linked section.
- **Editor**: switching to the editor always opens the document at the top,
even when the user had a specific section/selection in view on the content
page.

## Goal
Preserve the user's position/context when switching environments.

### 1. Rendered environments (preview, live, dev, review, prod)
Persist the URL **hash/anchor** (`#...`) to the target environment URL (and
back). This is the plain document anchor only.

### 2. DA editor (`da.live`)
When switching to the editor and the content source is **Document Authoring
(DA)**, carry the user's **current text selection** on the content page into
the editor so DA can restore/scroll to it.

- The selection is passed as a query param: `?select=`.
- Example:
`https://da.live/edit?select=Lorem+ipsum+dolor#/org/site/path`
- Only added when there is a non-empty selection and the source is DA.
- Non-DA editors (SharePoint, Google Docs, other BYOM) are unaffected.
- The param is intentionally **left in the URL** after processing so users can
share a link that reproduces the selection.

Contributor guide

Open the contributing guide

Research direction

Start at the env-switcher and edit plugin entry points, then trace how URLs are built when moving among rendered environments and into da.live. Done means rendered-environment switches preserve the document hash in both directions, while DA switches add a non-empty text selection as ?select= and leave it in the URL without changing non-DA editor behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.