mapbox/mapbox-gl-geocoder

Geocoder input hijacks focus when used in form

開放

#402 建立於 2020年11月24日

 (5 則留言) (5 個反應) (0 位負責人)JavaScript (182 個分叉)github user discovery
help wanted

倉庫指標

星標
 (386 顆星)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

Overview

When using the geocoder outside of a map, as part of a form, pressing the Enter key in another field will bring the focus of the form to the geocoder input. This is unexpected behavior which prevents users from submitting forms via Enter and breaks the overall flow of filling out a form.

Library Version

Reproducible Example

Expected Behavior

  • The Enter button should behave as it normally would in a form (i.e. submitting form when appropriate).

Current Behavior

  • The form changes focus to the geocoder input.

Notes

  • This issue doesn't seem to happen when the geocoder input is placed after the submit button, e.g.:
<!-- This order does not produce the focus-on-Enter issue -->
<input type="text" name="example_email" placeholder="Email">
<input type="submit" value="Submit" tabindex="-1">
<div class="geocoder"></div>

貢獻者指南