fix bug in show-hints inset #14287

Closed
marijnh wants to merge 1 commit from github/fork/alirrah/hints-inset-position into master
marijnh commented 2025-06-24 08:35:48 +02:00 (Migrated from gitlab.com)

When the show-hints box does not have space to be displayed below, the box will be displayed in the wrong place, which is also reported in this issue. I fixed this issue by making some changes, which you can see in the videos below.

The reason I added marginBottom is so that I can give the box some space from the bottom (I didn't want the box to stick to the bottom of the page).

before:

vokoscreenNG-2025-06-24_09-52-21.webm

after:

vokoscreenNG-2025-06-24_09-49-06.webm

When the show-hints box does not have space to be displayed below, the box will be displayed in the wrong place, which is also reported in [this issue](https://github.com/codemirror/codemirror5/issues/6993). I fixed this issue by making some changes, which you can see in the videos below. The reason I added `marginBottom` is so that I can give the box some space from the bottom (I didn't want the box to stick to the bottom of the page). before: [vokoscreenNG-2025-06-24_09-52-21.webm](https://github.com/user-attachments/assets/b79adcc4-659e-4aa7-bfbe-3bb4e2aabcbe) after: [vokoscreenNG-2025-06-24_09-49-06.webm](https://github.com/user-attachments/assets/a4267a16-af4b-4c31-a6c8-45958aa136c4)
marijnh commented 2025-06-24 09:50:51 +02:00 (Migrated from gitlab.com)

Do you have a minimal HTML page that shows the current issue happening? My response to the issue you linked suggests I haven't been able reproduce the issue.

Do you have a minimal HTML page that shows the current issue happening? My response to the issue you linked suggests I haven't been able reproduce the issue.
marijnh commented 2025-06-30 09:15:01 +02:00 (Migrated from gitlab.com)

You can see the error at the link below:
https://codesandbox.io/p/sandbox/wcndgs

As can be seen in line 272, the value of offsetTop should be subtracted from top, whereas in line 294 it has been added.

You can see the error at the link below: https://codesandbox.io/p/sandbox/wcndgs As can be seen in line 272, the value of offsetTop should be subtracted from top, whereas in line 294 it has been added.
marijnh (Migrated from gitlab.com) closed this pull request 2025-08-10 10:23:26 +02:00
marijnh commented 2025-08-10 10:26:00 +02:00 (Migrated from gitlab.com)

I can confirm that that plus should be a minus. I've corrected that in attached patch. I don't think adding an option like marginBottom is a good idea—firstly, it suggests we'd also need marginTop, marginLeft, and marginRight, and secondly, I don't think your implementation, as it stands, properly implements a bottom margin (just blindly moving the tooltip up will cause all the other computations to work with the wrong position). As such, I don't intend to merge that part, and suggest you work with something like transparent borders around the tooltip to get an effect like this.

I can confirm that that plus should be a minus. I've corrected that in attached patch. I don't think adding an option like `marginBottom` is a good idea—firstly, it suggests we'd also need `marginTop`, `marginLeft`, and `marginRight`, and secondly, I don't think your implementation, as it stands, properly implements a bottom margin (just blindly moving the tooltip up will cause all the other computations to work with the wrong position). As such, I don't intend to merge that part, and suggest you work with something like transparent borders around the tooltip to get an effect like this.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
codemirror/codemirror5!14287
No description provided.