setOptions() overrides previous modifiers
See original GitHub issueCodeSandbox demo code
import { createPopper } from "@popperjs/core";
const button = document.querySelector("#button");
const tooltip = document.querySelector("#tooltip");
// Create a popper instance with some offset
let popper = createPopper(button, tooltip, {
placement: "right",
modifiers: [{ name: "offset", options: { offset: [0, 20] } }]
});
// Uncommenting the following will remove the offset
// popper.setOptions({
// modifiers: [{ name: "eventListeners", enabled: true }]
// });
Steps to reproduce the problem
- Do
createPopper()
with an offset modifier - Call
setOptions()
to enable/disable listeners - The offset is now gone
What is the expected behavior?
I would expect existing modifiers to be unaffeted
What went wrong?
The offset is now gone
Any other comments?
My expectations come from the tutorial, where the behavior I expect is described. However pasting the tutorial’s full code into codepen, shows no offset.
This could be a documentation issue, since the actual tutorial code is different than the one displayed. But since I can’t find any clear documentation for setOptions()
, I will assume it is a bug.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
override java final methods via reflection or other means?
This will remove the 'final' modifier from the method. ... This should now use our new code when calling getDescription() which will include...
Read more >SocketOptions (Java Platform SE 8 ) - Oracle Help Center
Subclasses of these should override the methods of this interface in order to support their own options. ... Modifier and Type, Field and...
Read more >popper.js - Bountysource
In my app I am using custom elements to create a popout that uses popper for positioning. When I provide placement as "bottom",...
Read more >MathLive - CortexJS
Calling setOptions () on a mathfield with options related to the keyboard will affect this shared virtual keyboard instance when the mathfield is...
Read more >QWizard Class | Qt Widgets 6.4.1
These can be set using setOption() or setOptions(). For example, HaveHelpButton makes QWizard show a Help button along with the other wizard buttons....
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
I added an option to pass a function to setOptions that will work very similarly to how React’s state setters work.
https://popper.js.org/docs/v2/constructors/#setoptions
I haven’t included an auto-merge functionality because it would increase a lot the size of the library, I’d rather left this to the consumer if they ever need it.