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

RichText: fix backspace for IE #17256

Merged
merged 1 commit into from Aug 30, 2019

Conversation

@ellatrix
Copy link
Member

commented Aug 29, 2019

Description

Fixes #15945. The approach is as follows: call onInput when selection changes and then content has changed as well. Input always results in a selection change, so it's a good way to detect input in browsers that don't support the input event, such as IE.

How has this been tested?

Screenshots

Types of changes

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
Copy link
Contributor

left a comment

YAAAASS! You are amazing!

From purely a functional point of view, IE11 is now working as it should! So good. Thank you.

Codewise, it looks like a lot of red. Specifically it looks like it's actually REMOVING an IE fix. Does that mean the old fix was the cause of havoc?

In any case, such nice work. Thank you.

@ellatrix

This comment has been minimized.

Copy link
Member Author

commented Aug 29, 2019

Sort of. The old fix was introduced in #6667, I've never cared enough about IE so far to have a look at it. What that fix does is mapping the textinput event to input for IE, because IE doesn't support the input event. The problem is that textinput does not fire on deletion. So that fix tries to work around it by using keyup. The problem lies somewhere there. Perhaps the old fix can be fixed, but I don't really like the fix much, I think it might be better to look at selectionchange and see if there's any content change. If there is, call the input handler. The benefit of that is also we are sure that we can update selection and content at the same time, just like the input event. I think this approach makes the most sense... and it works.

@ellatrix

This comment has been minimized.

Copy link
Member Author

commented Aug 29, 2019

I'll wait to merge until there is a code review as well.

@jasmussen

This comment has been minimized.

Copy link
Contributor

commented Aug 29, 2019

Forgot to attach the GIF I recorded:

ie11

Copy link
Contributor

left a comment

Seems like a good improvement.

@talldan talldan merged commit c61bacc into master Aug 30, 2019
2 checks passed
2 checks passed
pull-request-automation
Details
Travis CI - Pull Request Build Passed
Details
@talldan talldan deleted the fix/ie-backspace branch Aug 30, 2019
@gziolo gziolo added this to the Gutenberg 6.5 milestone Aug 30, 2019
dd32 pushed a commit to dd32/gutenberg that referenced this pull request Sep 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.