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
Detected contentEditable
element.
#210
Conversation
I don't get it why you detect contentEditable element.
src/events/keyboard.ts
Outdated
if ( | ||
elem.tagName === "INPUT" || | ||
elem.tagName === "TEXTAREA" || | ||
elem.contentEditable === "true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that the value of contentEditable
attribute may be inherit
(default value), which means you have to traverse through all the ancestor elements to see if this one is editable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A simple but high-cost way to fix it:
while (elem) {
if (elem.contentEditable === "true") {
// do something
break;
}
elem = elem.parentElement;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just got an answer from stack overflow:
- elem.contentEditable === "true"
+ elem.isContentEditable
@Alecyrus can you modify your code like the above snippet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change the rules for detecting ContentEditable elements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
v8.4.1 is out |
I don't get it why you detect contentEditable element.
Description
Types of changes