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

Toolbar (bubbles) shouldn't show when setSelection() is called with 'api' #1193

Closed
eamodio opened this issue Dec 14, 2016 · 3 comments
Closed

Comments

@eamodio
Copy link

eamodio commented Dec 14, 2016

When using the bubbles theme, calling quill.setSelection({ index: 0, length: quill.getLength() }, 'api') causes the toolbar to show up. The same thing happens if silent is used. It shouldn't unless caused by the user.

Steps for Reproduction

  1. https://codepen.io/eamodio/pen/JbeXEQ?editors=0010

Expected behavior:

The toolbar doesn't show

Actual behavior:

The toolbar shows

Platforms:

macOS, Chrome

Version:

1.1.7

I also haven't been able to reproduce this in a sample yet but might be very related. I have intermittently seen that if quill is readOnly then sometimes you can still get the toolbar to show up.

@jhchen
Copy link
Member

jhchen commented Dec 22, 2016

What's the use case? It's not entirely intuitive that the toolbar should only show when source == 'user'. The reasoning is open and close should behave the same way and the toolbar should close or move whenever the selection changes regardless of source. Otherwise you could highlight a word causing the toolbar to show, and if the API with source==api removes the selection and the toolbar stays open, when the user clicks "bold" they will be very confused why their text is not bolded.

@jhchen jhchen added the triage label Dec 22, 2016
@eamodio
Copy link
Author

eamodio commented Dec 23, 2016

The use-case is to focus and pre-select all the text in an input to allow the user easy replacement (i.e. adding a new item to a list or something along those lines). And with having the toolbar automatically pop up makes it a jarring experience -- as the user pressed an add button (or the like), but now all of a sudden a toolbar pops up. If source isn't a good signal (though feels like it could be, though agree that closing the toolbar should probably happen regardless), maybe there could be a specific option to setSelection that avoids the toolbar opening?

@jhchen
Copy link
Member

jhchen commented Dec 29, 2016

Thank you for the details. The simplest route given the use case might just be to somewhat diverge open / close behavior like you suggested, where close always hides the tooltip but open will only show if the source is user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants