Skip to content

fix(NcRichContenteditable): keep previous cursor position on focus#7791

Merged
Antreesy merged 1 commit intomainfrom
fix/noid/keep-range-on-focus
Nov 7, 2025
Merged

fix(NcRichContenteditable): keep previous cursor position on focus#7791
Antreesy merged 1 commit intomainfrom
fix/noid/keep-range-on-focus

Conversation

@Antreesy
Copy link
Contributor

@Antreesy Antreesy commented Nov 6, 2025

☑️ Resolves

  • Since feat(NcRichContenteditable): put caret in the end when focus input #4924 either something was changed in browsers, or wasn't tested in different OS properly
  • ATM on Linux, unfocusing page with focused NcRichContenteditable and the focus the page back trigger @focus="moveCursorToEnd" event, effectively setting cursor to the end
  • Now, we check if element was previously focused/has a selection range, and keep it as-is
  • on Windows, can be tested with $0.blur(); $0.focus()

🖼️ Screenshots

🏚️ Before 🏡 After
B A

🚧 Tasks

  • ...

🏁 Checklist

  • ⛑️ Tests are included or are not applicable
  • 📘 Component documentation has been extended, updated or is not applicable
  • 2️⃣ Backport to stable8 for maintained Vue 2 version or not applicable

…ition was on same element

Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
@Antreesy Antreesy added this to the 9.2.0 milestone Nov 6, 2025
@Antreesy Antreesy self-assigned this Nov 6, 2025
@Antreesy Antreesy added bug Something isn't working 3. to review Waiting for reviews feature: rich-contenteditable Related to the rich-contenteditable components labels Nov 6, 2025
@codecov
Copy link

codecov bot commented Nov 6, 2025

Codecov Report

❌ Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.55%. Comparing base (b0a5563) to head (cda15a9).
⚠️ Report is 23 commits behind head on main.

Files with missing lines Patch % Lines
...ts/NcRichContenteditable/NcRichContenteditable.vue 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7791      +/-   ##
==========================================
- Coverage   51.57%   51.55%   -0.02%     
==========================================
  Files          96       96              
  Lines        3143     3146       +3     
  Branches      863      866       +3     
==========================================
+ Hits         1621     1622       +1     
- Misses       1274     1276       +2     
  Partials      248      248              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nickvergessen
Copy link
Contributor

Confirmed to fix the problem in:

  • Ubuntu + Chromium
  • Ubuntu + Firefox

@Antreesy Antreesy marked this pull request as ready for review November 7, 2025 10:10
@Antreesy
Copy link
Contributor Author

Antreesy commented Nov 7, 2025

/backport to stable8

@Antreesy
Copy link
Contributor Author

Antreesy commented Nov 7, 2025

Confirmed on macOS - Safari

@Antreesy Antreesy merged commit d21cce6 into main Nov 7, 2025
27 of 29 checks passed
@Antreesy Antreesy deleted the fix/noid/keep-range-on-focus branch November 7, 2025 10:21
@ShGKme ShGKme mentioned this pull request Nov 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews bug Something isn't working feature: rich-contenteditable Related to the rich-contenteditable components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants