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

Enhance inline reference element support #9

Closed
Justineo opened this issue Apr 7, 2016 · 9 comments
Closed

Enhance inline reference element support #9

Justineo opened this issue Apr 7, 2016 · 9 comments
Labels
feature This would be nice to have. PRIORITY: low

Comments

@Justineo
Copy link

Justineo commented Apr 7, 2016

It will be nice if popper has Tooltipster-like inline element support. See here.

@FezVrasta
Copy link
Member

This is pretty nice!

@FezVrasta
Copy link
Member

Related: #193 (comment)

@FezVrasta
Copy link
Member

FezVrasta commented Apr 20, 2017

This could be achieved with a custom modifier that takes the width of the text block on the 4 edges and then centers the popper accordingly... (I think).

In practice you would end up with:

{
  top: { start: 0, end: 200, width: 100 },
  right: { start: 0, end: 10, width: 10 },
  bottom: { start: 0, end: 100, width: 100 }
  left: { start: 0, end: 20, width: 20 }
}

To describe:
image

Where the grey borders are the valid edges where the popper could get anchored

@FezVrasta
Copy link
Member

Closing, feel free to implement it as a custom modifier if you need it.

@Narretz
Copy link

Narretz commented May 15, 2018

Hi @FezVrasta could you give me a hint on how this modifier would work? Which modifier would it replace in calculating the position? And could it be implemented so that it works together with the built-in modifiers like shift, preventOverflow etc?

Personally, I think this is a very useful feature, but I assume the complexity would add quite a bit to the core. I think it makes sense as a custom modifier, but I think some more input from you could definitely speed up the process in creating this.

@FezVrasta
Copy link
Member

I think it could run as first modifier of the list, doing so all the others will be able to work properly

@josephrocca
Copy link

Current behaviour is definitely counter-intuitive: https://jsbin.com/kulefoduvo/2/edit?html,output That tooltipster approach looks neat!

@atomiks
Copy link
Collaborator

atomiks commented Jun 15, 2019

Here's my current solution for this, using .getClientRects(). (Edit: solved the line-height caveat)

https://codepen.io/atomiks/pen/GeBoyW?editors=0010

How would you guys do it?

@atomiks
Copy link
Collaborator

atomiks commented Jun 16, 2019

^ So that behavior is a bit different to the tooltipster one. But it's also useful in cases of interactivity, by making it appear at the rect where the cursor landed.

For the tooltipster case, here's what I came up with: based on the current placement, it will choose the correct rect(s) and "sums" the rects on a particular side.

https://codepen.io/atomiks/pen/jjqbjy

I think the summing behavior also needs to be applied to the CodePen in the above comment as well, since the tooltip can overlap a line when it's not split as in the demo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This would be nice to have. PRIORITY: low
Projects
None yet
Development

No branches or pull requests

5 participants