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

Gutenberg 7.7.1/7.8: Simple Payments Block is removed if pasting into the email field #15121

Closed
GeoJunkie opened this issue Mar 25, 2020 · 7 comments · Fixed by WordPress/gutenberg#21162 or #15145
Assignees
Labels
[Block] Pay With Paypal aka Simple Payments Customer Report Issues or PRs that were reported via Happiness. aka "Happiness Request", or "User Report" [Feature] Pay with PayPal aka Simple Payments [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack [Type] Bug When a feature is broken and / or not performing as intended

Comments

@GeoJunkie
Copy link

Describe the bug
A clear and concise description of what the bug is.

To reproduce
Steps to reproduce the behavior:

  1. Edit a page
  2. Add a Simple Payments Block
  3. Paste any text into the Email field
  4. See that the field is removed

Expected behavior
The text should be pasted into the field

Screenshots
Screen Capture on 2020-03-25 at 16-45-37

Desktop (please complete the following information):

  • OS: MacOS V10.15.4 (19E266)
  • Browser Firefox
  • Version 74.0 (64-bit)

Additional context

  • Started with Gutenberg 7.7.1. Also tested on the 7.8 edge version.
  • This issue does not happen on previous versions
  • Discovered in WPCOM Calypso, also tested on JN with 7.7.1 and 7.8 Gutenberg versions
@GeoJunkie GeoJunkie added [Type] Bug When a feature is broken and / or not performing as intended [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack Simple Payments Customer Report Issues or PRs that were reported via Happiness. aka "Happiness Request", or "User Report" labels Mar 25, 2020
@glendaviesnz glendaviesnz self-assigned this Mar 26, 2020
@glendaviesnz
Copy link
Contributor

glendaviesnz commented Mar 26, 2020

The problem is caused by the fact that Gutenberg is using the input field DOM element selectStart attribute to determine if it is a text input. Inputs of type email return null for selectStart , so the method at https://github.com/WordPress/gutenberg/blob/master/packages/dom/src/dom.js#L454 returns false, and then the copy handler does not return at https://github.com/WordPress/gutenberg/blob/master/packages/block-editor/src/components/copy-handler/index.js#L46, and the gutenberg paste handler takes over and kills the email field.

@jeherve
Copy link
Member

jeherve commented Mar 26, 2020

Related: #11906

@simison
Copy link
Member

simison commented Mar 26, 2020

Should we temporarily make the field type=text at least on wpcom, if not in Jetpack?

@glendaviesnz
Copy link
Contributor

Should we temporarily make the field type=text at least on wpcom, if not in Jetpack?

The only other way I could see to fix in wpcom/jetpack ahead of a fix in gutenberg was to trap the copy/cut/paste events on the email field and stop propogation - PR doing this here - but this is much more heavy handed than just changing the email field to text for now.

@glendaviesnz
Copy link
Contributor

@simison & @jeherve - what are your thoughts on trapping the events versus changing field type to text as a temporary fix on wpcom/jetpack.

Trapping the events was an interesting exercise and may be useful to inform a solution in gutenberg that allows passing an extra prop to TextControl to indicate if native copy/paste should be preserved ... but it is probably overkill as a temporary fix. The field type change fixes the issue and email validation still works.

@simison
Copy link
Member

simison commented Mar 27, 2020 via email

@jeherve
Copy link
Member

jeherve commented Mar 27, 2020

Type text sounds better because of simplicity

Agreed, let's go with this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Pay With Paypal aka Simple Payments Customer Report Issues or PRs that were reported via Happiness. aka "Happiness Request", or "User Report" [Feature] Pay with PayPal aka Simple Payments [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
4 participants