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 isInputField #4271

Merged
merged 1 commit into from Jan 4, 2018
Merged

Fix isInputField #4271

merged 1 commit into from Jan 4, 2018

Conversation

ellatrix
Copy link
Member

@ellatrix ellatrix commented Jan 3, 2018

Description

Fixes #4268. I accidentally checked for lower case names in nodeName. 🙈 Adds tests too.

How Has This Been Tested?

Select a block, then select some text in an input field inside the block or in the inspector. The content of the section should be copied, not the whole block.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows has proper inline documentation.

@ellatrix ellatrix added the [Feature] Raw Handling Related to the ability to convert content to blocks, paste handling, etc label Jan 3, 2018
@ellatrix ellatrix requested review from mcsf and aduth January 3, 2018 22:36
@ellatrix
Copy link
Member Author

ellatrix commented Jan 3, 2018

Not sure about the tests btw, maybe that's a bit too much. :)

Copy link
Contributor

@mcsf mcsf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

Also, I think the tests are fine.

@ellatrix ellatrix merged commit 38177d6 into master Jan 4, 2018
@ellatrix ellatrix deleted the fix/copy-block-with-input-focus branch January 4, 2018 18:53
@aduth
Copy link
Member

aduth commented Jan 4, 2018

What should I expect as the result of isInputField given HTML:

<div contenteditable><span></span></div>

...and called as:

isInputField( document.querySelector( 'div > span' ) );

?

@ellatrix
Copy link
Member Author

ellatrix commented Jan 4, 2018 via email

@aduth
Copy link
Member

aduth commented Jan 5, 2018

Since it’s not the input field itself, I guess false?

Yeah, I guess the intention of the question is less "what would it return" (it returns false) and more: should it return false? Or should we consider the span to still be an "input" since it's technically editable?

Certainly an edge case, but one which I expect would be no fun to debug if it were encountered 😄

@ellatrix
Copy link
Member Author

ellatrix commented Jan 8, 2018

Hm, I would assume the person using isInputField is looking for the focusable input field. A span in side a contentEditable area is not an input field? 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Raw Handling Related to the ability to convert content to blocks, paste handling, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants