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

Text alternative leaks to the browser's window after pasting a lot of content to the balloon #752

Closed
Mgsy opened this issue Jan 3, 2018 · 5 comments
Labels
type:bug This issue reports a buggy (incorrect) behavior.
Milestone

Comments

@Mgsy
Copy link
Member

Mgsy commented Jan 3, 2018

🐞 Is this a bug report or feature request? (choose one)

  • Bug report

💻 Version of CKEditor

1.0.0-alpha2

📋 Steps to reproduce

  1. Go to http://localhost:8125/ckeditor5-core/tests/manual/article.html.
  2. Focus the editor and press Ctrl + A.
  3. Press Ctrl + C.
  4. Open the text alternative balloon.
  5. Focus the input.
  6. Hold Ctrl + V for few seconds.
  7. Press Save.

✅ Expected result

Text alternative is visible only inside the balloon's input.

❎ Actual result

Some part of the text alternative has appeared at the top of the browser

📃 Other details that might be useful

Notes

  • It appears on every image focus
  • If you click on the text, editor will crash with the error:
utils.js:36 Uncaught TypeError: Cannot read property 'getCustomProperty' of undefined
   at isWidget (utils.js:36)
   at Widget._onMousedown (widget.js:115)
   at Document.listenTo.args (widget.js:83)
   at Document.fire (emittermixin.js:269)
   at MouseObserver.fire (domeventobserver.js:96)
   at MouseObserver.onDomEvent (mouseobserver.js:29)
   at ProxyEmitter.listenTo (domeventobserver.js:79)
   at ProxyEmitter.fire (emittermixin.js:269)
   at HTMLDivElement.domListener (emittermixin.js:237)

GIF

bug_cke5

Other information

OS: Windows 10, MacOS X
Browser: All browsers

@Mgsy Mgsy added the type:bug This issue reports a buggy (incorrect) behavior. label Jan 3, 2018
@Reinmar
Copy link
Member

Reinmar commented Jan 3, 2018

WUT... So weird :D

@Reinmar
Copy link
Member

Reinmar commented Jan 17, 2018

cc @oleq

@oleq
Copy link
Member

oleq commented Jan 17, 2018

It's super weird but this is what happens:

  1. When the widget is selected, some sort of a paste bin shows up containing the following content
    image. Once the widget is blurred, the paste bin disappears.
  2. Upon paste in the text alt input, the bin gets all the pasted content, which is weird. Is it by design? What's the purpose of that bin, BTW?
  3. When the widget is re-selected, paste bin shows up in DOM again, with the same content it had after the paste. Which is also totally weird.
  4. Because there's a looooot of text in the paste bin, -9999px is not enough to hide it off screen.

@Reinmar
Copy link
Member

Reinmar commented Jan 17, 2018

This is a so-called fake selection container. We need to use it to store the real selection when a widget is selected (because the browser would not allow selecting such elements).

However, it should never get any data. Especially not if another input is selected. It sounds like a browser bug.

OTOH, it's a complete edge case to paste that much content into a link URL input. It might only happen by accident, in fact.

As a kind of bulletproofing fake selection container's implementation we can add listeners to stuff like paste, drop, keydown in there and preventDefault() on them. Although, since it's not an editing host itself (the root editable is) we'd need to use the capturing phase.

@oleq
Copy link
Member

oleq commented Jan 18, 2018

Considering the above, I think the easiest (and the fastest) solution is limiting FSC's width. I checked and width: 42px works like a charm.

Reinmar added a commit to ckeditor/ckeditor5-engine that referenced this issue Jan 19, 2018
Reinmar added a commit to ckeditor/ckeditor5-engine that referenced this issue Jan 19, 2018
Fix: The fake selection container will not leak into the viewport. Closes ckeditor/ckeditor5#752.
@Reinmar Reinmar added this to the iteration 14 milestone Jan 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

No branches or pull requests

3 participants