Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AMP-html how to prevent lightbox close when user click on an input

Tags:

amp-html

I have a amp-lightbox and a form in it.

 <amp-lightbox id="search-word"
                  layout="nodisplay">
        <div class="lightbox"
             on="tap:search-word.close"
             role="button"
             tabindex="0">
            
            <form id="search-word" role="search" action="https://localanagrammer.com/" target="_top">
                <div class="input-group">
                    <input type="text" id="searchWord" class="form-control" placeholder="enter scrabble word" data-ng-model="keyword" autocomplete="off" autofocus>
                    <span class="input-group-btn">
                        <button class="btn btn-default" type="button" data-ng-click="doSearch(keyword)">
                            <span class="fa fa-search" aria-hidden="true"></span>
                        </button>
                    </span>
                </div>
            </form>
        </div>
    </amp-lightbox>

The lightbox is being closed when I try to click on text input.

The question is: What is the correct way to prevent closing?

like image 275
Vazgen Manukyan Avatar asked Oct 31 '25 23:10

Vazgen Manukyan


1 Answers

I have solved it by placing a tap with an open action in the inner element. A similar situation here is (this is a React code that renders the AMP html):

        <amp-lightbox
            id="mylightbox"
            on="tap:mylightbox.close"
            class="dark-lightbox-background"
            layout="nodisplay">
            <div 
                class="container"
                on="tap:mylightbox.open">

                 <!-- content placed here -->

            </div>
        </amp-lightbox>
like image 110
Pedro Israel Avatar answered Nov 04 '25 04:11

Pedro Israel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!