Nextcloud-vue: "v-click-outside" does not work in certain browsers

Created on 22 Oct 2019  路  1Comment  路  Source: nextcloud/nextcloud-vue

v-click-outside does not work in Edge nor Internet Explorer 11. It does not work either in old Firefox versions; theoretically it should work already in Firefox 52, but it does not seem to be the case.

v-click-outside listens to all click events in the document and then calls the associated function when the event target is not a child of the element. To do this, it uses Event.composedPath (and Event.path, which seems to be specific to Chromium). However, in those browsers in which composedPath is not implemented every click is seen as done outside the element.

Due to this, when v-click-outside is used to close a menu clicking on an element inside the menu closes the menu. Moreover, this may prevent the element to perform its associated action, for example, if the element is a checkbox.

This should be fixed by changing to a different directive library, implementing our own, or adding a polyfill for Event.composedPath (an easy polyfill would be to traverse the parent elements of the event target and return them, although there are surely subtleties that could cause other interesting and hard to debug issues :-P ).

3. to review bug

Most helpful comment

We probably should try if we can replace vue-click-outside with v-click-outside. The benefit would be that it is actually maintained and doesn't use the composedPath method, but not sure if it has other downsides.

>All comments

We probably should try if we can replace vue-click-outside with v-click-outside. The benefit would be that it is actually maintained and doesn't use the composedPath method, but not sure if it has other downsides.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

raimund-schluessler picture raimund-schluessler  路  9Comments

ma12-co picture ma12-co  路  5Comments

janis91 picture janis91  路  5Comments

raimund-schluessler picture raimund-schluessler  路  3Comments

szaimen picture szaimen  路  8Comments