Any time a template or parameter receives user events, it should be highlighted in both the sidebar and content, and if necessary the page should scroll to make it visible.
**Acceptance criteria**
|** action on the left **| results in the sidebar T311204 | results in the **content pane**
| ----- | ----- | -----
| **select** a **template or wikitext** transclusion (press space) | [x] blue highlight | [x] scroll into view [x] focus stays in sidebar
| **select a parameter** (press space) | [x] blue highlight | [x] scroll into view [x] focus stays in sidebar T296996
| **unselect a selected parameter** (space or checkbox click) that was **selected** | [x] selection goes away (remove blue highlight) | [x] focus stays as is T296996, T312213 [x] no scrolling
| **unselect a parameter** (space or checkbox click) that was **not selected** | [x] nothing happens | [x] should just be removed [x] focus stays as is T296996 [x] no scrolling
| **hover** (cursor keys up and down or mouse cursor) | [x] grey highlight on unselected elements [x] no change on selected elements | [x] no scrolling [x] no focus
| add a **new template** or **new wikitext** (with the buttons) | [x] blue highlight on new element | [x] focus on new input field
| press the **delete button** in the toolbar to delete a template or wikitext transclusion | [x] selection jumps to following element (template or wikitext), except if there is no element below, [] then jump to previous part T312221 | [x] template or wikitext is hidden
| typing into **parameter filter** | [x] removes any selections and associated highlights [[ https://gerrit.wikimedia.org/r/c/mediawiki/extensions/VisualEditor/+/810019 | 810019 ]] | [x] nothing happens
| **hard select** (press enter or mouse click on any element) | [x] blue highlight | see next table
Different effects in desktop and mobile
|** action **| results in the **desktop skin** | results in the **mobile skin** | results in **narrow mode** T290975
| ----- | ----- | ----- | -----
| press **enter** or mouse **click on** a **template name** in the sidebar | [x] scroll into view [x] focus moves to link in description | [x] scroll into view [x] focus stays | after view flip: [x] scroll into view
| press **enter** or mouse **click on** a **wikitext item** in the sidebar | [x] scroll into view [x] focus moves to input field | [x] scroll into view [x] focus stays | after view flip: [x] scroll into view
| press **enter** or mouse **click on** a **parameter** in the sidebar | [x] scroll into view [x] focus moves to input field | [x] scroll into view [x] focus stays |after view flip: [x] scroll into view
| click **new template** or **new wikitext** button | [x] focus on input | [x] focus on input | after view flip (see also T291365): [x] scroll into view
| focus an **input element** in the content pane | [x] scroll into view [x] highlighted T311204 | [x] scroll into view [x] highlighted T311204 | after view flip: [x] scroll into view [x] highlighted |
| focus a **wikitext input** in the content pane | [x] scroll into view T291381 [x] highlighted | [x] scroll into view T291381 [x] highlighted | after view flip: [ ] scroll into view [x] highlighted
[x] Disable the bogus auto-scroll feature described in T289043#7297679.
**Dev notes**
This partly depends on the keyboard navigation work in {T285323}, which will refactor events. We'll probably need to disconnect old sidebar events, either by preventing it from being created, or by putting conditionals around code that connects its event handlers.