tonysamperi / ngx-popperjs

An Angular 8+ wrapper for @popperjs/core
https://tonysamperi.github.io/ngx-popperjs/
MIT License
65 stars 12 forks source link

BUG: PopperTrigger has to be declared in template (no default) #13

Closed Artaud closed 3 years ago

Artaud commented 3 years ago

Describe the bug This is the same bug as described in https://github.com/MrFrankel/ngx-popper/issues/26 You cannot omit PopperTrigger attribute in the template if you want to create the most basic popper.

To Reproduce Create the most basic popper:

<div [popper]="'Popper text'">

It will not show the tooltip when hovering over the div. To make it show, you have to add the PopperTrigger attribute

<div [popper]="'Popper text'" [popperTrigger]="'hover'">

Expected behavior Tooltip should show on hover even without declaring [popperTrigger]="'hover'" as that should be the default according to the documentation.

Additional context This is on the latest version of the library (12.1.2).

tonysamperi commented 3 years ago

Basically there was a default but it was ignored because of an old property name (showTrigger) from popper.js. This problem has been present since v8 I guess, although I could never find it, because I expected the default to be click, since I believe it's the most common use case. Also because there was a casting in that object, so it didn't error although it should have. Don't know if it's my fault or Mr Frankel's. Anyway I removed the useless property and updated the docs, with the correct default click.