File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
assets/js/phoenix_live_view Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -868,7 +868,17 @@ export default class LiveSocket {
868868 dispatchClickAway ( e , clickStartedAt ) {
869869 const phxClickAway = this . binding ( "click-away" ) ;
870870 DOM . all ( document , `[${ phxClickAway } ]` , ( el ) => {
871- if ( ! ( el . isSameNode ( clickStartedAt ) || el . contains ( clickStartedAt ) ) ) {
871+ if (
872+ ! (
873+ el . isSameNode ( clickStartedAt ) ||
874+ el . contains ( clickStartedAt ) ||
875+ // When clicking a link with custom method,
876+ // phoenix_html triggers a click on a submit button
877+ // of a hidden form appended to the body. For such cases
878+ // where the clicked target is hidden, we skip click-away.
879+ ! JS . isVisible ( clickStartedAt )
880+ )
881+ ) {
872882 this . withinOwners ( el , ( view ) => {
873883 const phxEvent = el . getAttribute ( phxClickAway ) ;
874884 if ( JS . isVisible ( el ) && JS . isInViewport ( el ) ) {
You can’t perform that action at this time.
0 commit comments