Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix selecting attachments in MS Edge #531

Merged
merged 3 commits into from Sep 12, 2018
Merged

Conversation

@javan
Copy link
Member

@javan javan commented Sep 11, 2018

Currently, Trix programmatically selects attachments using a DOM Range anchored to the text nodes in the surrounding cursor target elements.

<span>⋮</span><figure>…</figure><span>⋮</span>

represents a zero width space character.

That range has worked reliably in all browsers including Microsoft Edge… until recently. Edge 17 regressed from 16 and incorrectly applies it around the left cursor target’s text node. Turns out this issue exists in earlier versions of Edge too. This issue may have exacerbated the problem in Trix starting with Edge 17. 🤷‍♂️

<span>⋮ </span><figure>…</figure><span></span>

This change works around the problem by anchoring to the cursor target elements instead of their text nodes.

<span>⋮</span><figure >…</figure><span>⋮</span>

The resulting selection is visually and functionally equivalent.

Fixes selecting attachments in MS Edge 17
@javan javan added the WIP label Sep 11, 2018
@javan javan removed the WIP label Sep 12, 2018
@javan javan merged commit d673de4 into master Sep 12, 2018
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@javan javan deleted the msedge-17-attachment-selection-fix branch Sep 12, 2018
@javan javan changed the title Fix selecting attachments in MS Edge 17 Fix selecting attachments in MS Edge Sep 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant
You can’t perform that action at this time.