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

Gutter tooltip position inside container #5520

Open
alitan opened this issue Mar 24, 2024 · 3 comments
Open

Gutter tooltip position inside container #5520

alitan opened this issue Mar 24, 2024 · 3 comments

Comments

@alitan
Copy link

alitan commented Mar 24, 2024

Describe the bug

Gutter tooltip position (which is currently calculated for fixed positioning container), is not working when the editor is in a container div. The new container queries and container-type: size or container-type: inline-size for parent breaks the fixed positioning.

Expected Behavior

Gutter tooltip position being calculated properly, either following mouse or not.

Current Behavior

Gutter tooltip position is not correct ( working as relative positioning) when the parent container has container query.

Reproduction Steps

Assing container query on the parent for the editor.

Possible Solution

Gutter tooltip can be handled like Autocomplete popup content. (append to body). That way it will not be affected by editors parent positioning and container css attribute.

Additional Information/Context

No response

Ace Version / Browser / OS / Keyboard layout

1.32.8 / Chrome / Windows

@InspiredGuy
Copy link
Contributor

Hey @alitan, thank you for the report. Could you please attach a small example with an editor in a div using container queries, where you the issue is reproducible?

@alitan
Copy link
Author

alitan commented Mar 28, 2024

hello, here is an example that i put together on codepen. >> https://codepen.io/alitan/pen/rNbGOQE
if you resize the browser small enough (so that you see the container query kicking in) and rollover the "x" gutter mark you will see that the tooltip is not in the right place.

@whazor
Copy link
Contributor

whazor commented Aug 22, 2024

There are many CSS settings where a new relative viewport is created. For example also position: fixed, but also these containers indeed.

Many elements in Ace, such as auto-complete/tooltips and also these gutter tooltips are positioned to the browser viewport. But the elements gets incorrectly positioned against new viewport. The solution is to move the elements to document.body (or an element underneath document.body).

For normal tooltip:

new Tooltip(document.body);

For autocomplete:

const completer = Autocomplete.for(aceInstance);
completer.parentNode = document.body;

However, by default gutter tooltips are always attached to the editor.

class GutterTooltip extends Tooltip {
constructor(editor) {
super(editor.container);

So we would need to make this configurable.

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

3 participants