Phenomenon
When applying a font family to selected text in Safari and then continuing to type, the new text does not inherit the font family. The font formatting is lost for newly typed characters.
Reproduction example
- Select some text in a contenteditable element
- Apply a font family (e.g., “Arial”)
- Place cursor after the formatted text
- Type new text
Observed behavior
- The newly typed text uses the default font, not the applied font
- Font formatting is not maintained for new text
- This differs from Chrome/Edge where font persists
- User must reapply font for each new text segment
Expected behavior
- Newly typed text should inherit the font family
- Font formatting should persist until explicitly changed
- Behavior should be consistent with Chrome/Edge
Browser Comparison
- Chrome/Edge: Font family persists for new text
- Firefox: Font persistence may be less reliable
- Safari: Font does not persist (this case)
Notes and possible direction for workarounds
- Intercept text insertion and apply font formatting
- Use
beforeinputevent to detect text insertion - Apply font style to newly inserted text
- Maintain font state for current typing position