Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(inline-tool-link): use defaultValue to prevent selectionchange event#2993

Open
akulistus wants to merge 1 commit intonextfrom
fix-inline-popover-re-renders
Open

fix(inline-tool-link): use defaultValue to prevent selectionchange event#2993
akulistus wants to merge 1 commit intonextfrom
fix-inline-popover-re-renders

Conversation

@akulistus
Copy link
Contributor

Problem:
Inline-popover re-renders constantly while text with link-tool formatting is selected.

Description:
Value assignment at line-215
causes a selectionchange event that triggers inline-popover re-render.

example
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <title>selectionchange demo</title>
</head>
<body>
  <button id="valueBtn">Set value</button>
  <button id="defaultValueBtn">Set defaultValue</button>
  <br /><br />

  <input id="input" />

  <script>
    const input = document.getElementById('input');

    document.addEventListener('selectionchange', () => {
      console.log('selectionchange');
    });

    document.getElementById('valueBtn').onclick = () => {
      input.value = 'value text';
      console.log('value set');
    };

    document.getElementById('defaultValueBtn').onclick = () => {
      input.defaultValue = 'defaultValue text';
      console.log('defaultValue set');
    };
  </script>
</body>
</html>

Issue:
#2987

Solution:
Change input value assignment to defaultValue to prevent the selectionchange event.

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.

1 participant