Prevents layout shift by rendering the recorder in the editor's main content
area instead of in the after buttons section. Uses replacementContent prop
to swap the editor with the recorder while maintaining proper padding.
When recording on mobile, if the pointerup listener was lost (e.g., dragging
off the button), there was no way to stop recording. Now the stop button's
onClick handler works on mobile when recording is active, providing a fallback.
Covers the two bugs fixed in the previous commit:
- Verifies the first button gets data-selected="true" on initial render so the
CSS highlight rule fires immediately (regression for the dep-array fix).
- Verifies the first button is also stamped when async search results load new
buttons after the initial render (the original regression).
- Verifies keyboard navigation via the AUTOCOMPLETE_NAVIGATE_EVENT moves the
selected index and that it clamps at the list boundaries.
Also adds an eslint-disable comment in AutocompleteMenu.tsx explaining why
the no-dep-array useLayoutEffect is intentional (setSelectedIndex is a stable
React setter; the conditional call cannot cause an infinite loop).
Two related bugs in the mention/room/emoji autocomplete:
1. Enter key always inserted the first suggestion instead of the highlighted one.
Cause: querySelector('[data-selected]') matched ALL buttons since every button
has the attribute set to either 'true' or 'false'. The first button in DOM
order was always returned.
Fix: use '[data-selected="true"]' to select only the active item.
2. The first item had no visual highlight on initial open (the CSS rule requires
data-selected='true', but the useLayoutEffect responsible for stamping that
attribute only re-ran when selectedIndex changed -- not when buttons first
appeared after async search results loaded).
Fix: remove the dep array so the effect runs after every render; newly-loaded
buttons are stamped immediately.