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: Context menu not appearing in Firefox #154

Merged
merged 1 commit into from Aug 23, 2023
Merged

Conversation

keegangeorge
Copy link
Member

@keegangeorge keegangeorge commented Aug 23, 2023

This PR fixes some issues where the context menu would not appear in Firefox.

1. event.target

In Firefox, event.target.activeElement does not exist, instead we need to use event.target, however the issue is that in all other browsers event.target inside <textarea> elements points to the HTML DOM, not a specific element. In all other browsers we need to use event.target.activeElement to point to the <textarea>

To resolve this so that works on all browsers we use document.activeElement and compare it with this._dEditorInput to see if it is the same.

2. window.getSelection().toString()

In Firefox, window.getSelection().toString() will always result in an empty string. Due to this bug in Firefox, we instead use selectionStart and selectionEnd to identify what is selected from the document.activeElement's value.

This PR has been tested on Firefox, Chromium, and Safari to ensure all functionality works correctly.

@keegangeorge keegangeorge merged commit 3cf316f into main Aug 23, 2023
4 checks passed
@keegangeorge keegangeorge deleted the fix-firefox branch August 23, 2023 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants