Link tooltip cut off by edge of editor
Chrome 42 on a Mac
To reproduce, go to to quill's homepage, and try to add a link to the left-most word on a line. For me, the link tooltip becomes partially obscured. Screenshot attached.

I've noticed this as well for all the tooltips. It should be detecting the edge of the editor.
Also, something I've been wondering about for awhile @jhchen, why do the tooltips use a high negative number for the left css property to hide them instead of visibility: hidden or display: none? Ideally, I'd think you'd just want to add a class like ql-active to the tooltip and have the correct display value in the CSS files.
Think I found (part of) the issue. Right now, I'm fiddling with this line
Presently, it is adding half of the referenceBounds.width and subtracting half of the tooltipBounds.width from an offset to calculate the left attribute of the tooltip.
I made a change to subtract half of the referenceBounds.width and add half of the tooltipBounds.width, and the tooltip no longer gets cut-off, but its placement seems slightly off.
I'm going to keep fiddling, but if anyone has insights please pass them along!
That code seems to be correct, there just needs to be an extra check to make sure that the value that's calculated is not less than 0, if so it should set it to 0.
Touché! Trying that now.
Works, but the issue then becomes that (on smaller screens) the Change Remove and Done links get cut off on the right. :grimacing:
It probably needs to wrap depending on it's width then. @jhchen will need to weigh in on how he'd like to handle that.
Yeah I fixed by getting rid of the white-space: nowrap; style on the .ql-tooltip class. But I'm assuming that's there for a reason sooooo. Yeah.
Thanks for your comments @willrowe!
The initial implementation of the tooltip was when Quill was still in an iframe so it necessarily had to be confined within the editor so there was logic that would place the tooltip to avoid being cut off (in the vertical direction as well).
Now there's not necessarily that motivation with iframes removed which is why https://github.com/quilljs/quill/commit/04c7c277bce2e879c32aa2cdc2df60f4bd82bd5c landed but it looks like just a high z-index on the tooltip is not sufficient--the overflow-y on .ql-container needs to be removed as well to fix this particular issue. However this is an important rule to allow scrolling in the editor so I'm not sure right now what the best solution is but thought I'd add some context.
@willrowe The high negative margin is because browsers do not correctly report dimensions when an element is hidden. I'm can't remember if/why visibility was passed over as well though.
@jhchen - How would you feel about:
- Ensuring the
leftattribute is non-negative - Removing
white-space: nowrap;from the CSS onql-tooltip(replacing withwhite-space: normal?)
Alternatively, it'd be possible to avoid the overflow issue outright by using fixed instead of absolute positioning for the tooltip(s)... but that would in turn require redoing the position calculations.
/shrug
The tooltip placement has been reverted to be within the editor https://github.com/quilljs/quill/commit/fd099bb40db8557570da544d5976e2f250bba463.
Guys, somehow it is not working now again. Using react-quill (quill is the latest version).
Seems to be working when using Snow theme, but Bubble is definitely broken.
- Go to: https://quilljs.com/docs/themes/
- Scroll to the Bubble sample
- Enter some text on the first line
- Turn the first word into a link
- Hover the link. The bubble tooltip is cut off by the edges of the editor.
I tried playing around with the CSS, I couldn't get it to work.
Anyone have a css fix for the url popup on bubble theme? Confirmed the issue is visible on https://quilljs.com/docs/themes/ as @Carl012 describes. Just paste a url into top line then hover over it to see issue.
Edit - this looks to fix it. .ql-editor { overflow: visible; }
I found a solution for my situation: when create the configuration object, set property 'bounds' with the selector of quill container.
Example:
const SELECTOR_CONTAINER = '#quill-container-2';
const DEFAULT_CONFIG = {
theme: 'bubble',
bounds: SELECTOR_CONTAINER
};
new Quill(SELECTOR_CONTAINER, DEFAULT_CONFIG);
This positions the video tooltip at a fixed position
$(document).ready(
function() {
$('.ql-video').click(function() {
$('.ql-tooltip').css("left", "0");
$('.ql-tooltip').css("margin-left", "10px");
$('.ql-tooltip').css("top", "0");
$('.ql-tooltip').css("margin-top", "2px");
}
);
}
);
I found a solution for my situation: when create the configuration object, set property 'bounds' with the selector of quill container.
Example:
const SELECTOR_CONTAINER = '#quill-container-2'; const DEFAULT_CONFIG = { theme: 'bubble', bounds: SELECTOR_CONTAINER }; new Quill(SELECTOR_CONTAINER, DEFAULT_CONFIG);
This is what worked for me. Thank you!!
If anyone is using angular, then you can try the following in your css or scss file ;)
::ng-deep.ql-tooltip {
left: unset !important;
}
This works for me
.ql-tooltip {
left: 0 !important;
}
Had the same problem. @petemcwilliams 's solution worked for me
@FenoRC's solution also work for me. As if bounds not defined, tooltips positioned using document. I could also use this solution for react implementation ReactQuill like:
<div data-text-editor="name">
<ReactQuill
theme="snow"
value={formContext[name]}
onChange={handleTextChange}
bounds={`[data-text-editor="name"]`}
/>
</div>