HomeiOS Developmentjavascript - iOs deal with enter and open digital keyboard

javascript – iOs deal with enter and open digital keyboard


What I wish to obtain:

I desire a dropdown with a search subject the place the main target mechanically jumps to the enter subject and the digital keyboard of iOs seems for the enter.

The present component with dropdown is created in a WordPress builder with a container div. There i added my searchform.

enter image description here

The place it really works:

Focusing works in all desktop browsers comparable to Chrome, Firefox and Safari with none issues.

iOs will not work:

Solely beneath iOs there isn’t a focus and no name of the digital keyboard.

I’ve already tried a number of options from Stackoverflow, however with out success. Maybe that is additionally because of the truth that this component of the theme, which executes the dropdown, and my script don’t harmonize.

The component for the set off and the content material of the container are two completely different parts.
(I’ve shortened the weather a bit for simpler presentation.)

Toggle Factor:

<div id="bl-search-anchor-toggle" function="button" tabindex="0">
  <div class="x-anchor-content">
     <div class="x-icon"><svg>...icon...</svg></div>
     <div class="x-anchor-text">Search</div>
   </div>
</div>

Dropdown Content material Factor
The whole lot beneath id=”my-content” was added by me.

<div id="bl-search-dropdown">
  <div id="my-content">
     <kind function="search" technique="get" id="searchform" motion="https://...">
    <div>
      <label class="screen-reader-text" for="s">Seek for:</label>
      <enter kind="textual content" worth="" title="s" id="s" tabindex="-1">
      <enter kind="submit" id="searchsubmit" worth="Search">
    </div>
    <enter kind="hidden" title="post_types" worth="web page">
    <enter kind="hidden" title="cat" worth="4"></kind>
  </div>
</div>

The java script i exploit:

window.onload
{
  doc.getElementById("bl-search-anchor-toggle").addEventListener("click on", focus_search());
}

operate focus_search()
{
  const s = jQuery("#bl-search-dropdown #s").get(0);
  s.tabIndex = '-1';     // Appears to be wanted for chrome, firefox, safari too
  s.focus();
} 

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments