[Core] Add `relative` modifier
See original GitHub issueHey, thanks for creating the library
I’m suggesting to add a relative
modifier to the library, which let’s you align tooltips relative to element from another context
The use-case for this is aligning tooltips within iframes or on canvas (where you know the relative coordinates upfront)
Here’s the modifier code:
const relative = {
name: 'relative',
fn: ({ x, y, element }) => {
const rect = element.getBoundingClientRect()
return {
x: rect.left + x,
y: rect.top + y
}
}
}
without relative
modifier
with relative
modifier
you can already achieve similar functionality by using virtual elements
Issue Analytics
- State:
- Created a year ago
- Comments:10
Top Results From Across the Web
Modifier - Android Developers
A Modifier that can add padding to position the content according to specified distances ... the alignment line relative to which the padding...
Read more >net - How to get relative path from absolute path - Stack Overflow
NET Core 2.0 has Path.GetRelativePath which can be used like so: var relativePath = Path.GetRelativePath( @"C:\Program Files\Dummy Folder\MyProgram ...
Read more >Coding Corner: How to appropriately apply modifiers LT, RT ...
The MPFS Relative Value File shows a 1 modifier indicator in the BILAT SURG column for this code; therefore, modifier 50 may be...
Read more >A library for writing Ember modifiers - GitHub
ember-modifier. This addon provides an API for authoring element modifiers in Ember. It mirrors Ember's helper API, with variations for writing both simple ......
Read more >ASP.NET Core Razor components - Microsoft Learn
Optionally, components can be added to the NavMenu component so that a ... However, C# assumes the private access modifier when no access ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just thought I’d mention that the project I work on had a very similar custom middleware solution for offsetting an iframe to the one shown in the issue description.
A problem I encountered is that custom middleware that provides an offset doesn’t seem compatible with floating ui’s shift middleware (when used with
limitShift
). That seems to expect any offsets to be provided through middleware data: https://github.com/floating-ui/floating-ui/blob/77c4b27a8096cafe06e58b2c7592317d6d3a3aea/packages/core/src/middleware/shift.ts#L203-L212I see. My mistake is that I didn’t realise that some middleware (like flip) has a different definition of main/cross axis. Flip is the definition I saw first and I ran with that. 🤦
I was finding it a bit confusing, but now it makes a lot more sense. Thanks for clarifying.