Skip to content

Conversation

@Zynton
Copy link

@Zynton Zynton commented Nov 17, 2025

This PR addresses a bug that can be reproduced as follows:

  1. Create a list before or after a paragraph
  2. Indent the list
  3. Insert a code block in it
  4. Type in the code block

-> the selection is ejected from the code block.

The issue was due to preserveTextareaSelections: its condition to restore the focus within a textarea was never met. As a result, when the active selection was changed during normalization, the focus was lost.

Fixing this revealed a double issue with the undo and redo functions:

  1. the focus should be set before setting the selection (otherwise changing the focus might change the selection back)
  2. body.focus() doesn't do anything, we need to do editable.focus().

While fixing the issue, an unrelated problem was noticed and also addressed here: invisible whitespace that would become visible in a <pre> element should be removed before turning a block into a <pre>.

task-5262154

Invisible whitespace that would become visible in a `<pre>` element
should be removed before turning a block into a `<pre>`.

task-5262154
This commit addresses a bug that can be reproduced as follows:

1. Create a list before or after a paragraph
2. Indent the list
3. Insert a code block in it
4. Type in the code block

-> the selection is ejected from the code block.

The issue was due to `preserveTextareaSelections`: its condition to
restore the focus within a textarea was never met. As a result, when the
active selection was changed during normalization, the focus was lost.

Fixing this revealed a double issue with the `undo` and `redo`
functions:
1. the focus should be set _before_ setting the selection (otherwise
   changing the focus might change the selection back)
2. `body.focus()` doesn't do anything, we need to do `editable.focus()`.

task-5262154
@robodoo
Copy link

robodoo commented Nov 17, 2025

This PR targets the un-managed branch odoo-dev/odoo:19.0-syntax_highlighting_readonly-age, it needs to be retargeted before it can be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants