Commit Graph

42 Commits

Author SHA1 Message Date
Martin Raifer dcd7fb4938 don't include misspelled taginfo suggestions in combo fields 2022-12-02 13:49:49 +01:00
Martin Raifer 41aa127d23 reduce use of parseFloat
as it silently strips non-numeric suffixes (e.g. a value of "123 foo" is transformed into a numeric value of 123 by `parseFloat`, which is typically not what we desire)
2022-11-24 19:39:15 +01:00
Martin Raifer 62113dcf74 improve icons in comboboxes: update while typing, fix spacings
also makes sure checkbox & radio are aligned with the left padding of the respective input fields
2022-11-08 18:48:06 +01:00
Martin Raifer a6be05966b improve comboboxes: (#9344)
* pressing return/enter doesn't deselect the entity anymore
* predefined ("static") field options are always listed in the combobox dropdown, even if taginfo doesn't include them (because of low usage)
* (raw) tag values can also be entered for localized strings
* static localized strings can be used before taginfo response is received (useful when taginfo is slow or unavailable)
* fixes some bugs which can be triggered when taginfo is slow
* fixes a bug where the autocomplete dropdown doesn't work properly when tags have "few" values
* multiCombo fields can be case-sensitive now
2022-11-08 12:09:06 +01:00
Martin Raifer 8f79932ab1 prevent html injection in combobox dopdowns
and use returned wikidata label language for html `lang` metadata
2022-06-06 12:47:14 +02:00
mukesh 180e554b7d Fixed bug Wikidata field displays [object Object] 2022-06-06 12:44:57 +02:00
Gabor Hodi 2ecce0e47e [Issue8871] Do not open disabled localized combobox when clicking on it 2022-01-23 18:51:14 +01:00
Martin Raifer 195e287923 fix rendering of combobox items 2021-11-30 13:49:24 +01:00
Martin Raifer 040257fd44 replace unnecessary setting of raw "html" with "text" 2021-11-18 18:53:33 +01:00
Quincy Morgan cb7f1c2b3c Update to id-tagging-schema v3.0.0
Add UI for translatable combo fields
2020-12-08 15:23:51 -05:00
Quincy Morgan 21a49bbec8 Initial support for D3 v6.2.0 2020-10-06 15:08:39 -04:00
Quincy Morgan 4600ab596f Add lang attribute to more display labels (re: #7963) 2020-09-23 10:10:24 -04:00
Quincy Morgan 32f8274929 Make t function return a span element with a lang attribute unless html: false is specified in the options (re: #7963)
Update `text` functions to `html` to support inserting the `span` elements
Specify `html: false` for various instances where a `span` is not desired, e.g. `placeholder` and `title` attributes
2020-09-15 21:56:22 -04:00
Quincy Morgan 7f9b1d0e9a Account for container offset when positioning combobox dropdowns (close #7458) 2020-03-29 09:54:48 -07:00
Quincy Morgan 0931459dba Reduce use of global selection (re: #7445) 2020-03-24 13:02:06 -07:00
Quincy Morgan ed79ba1289 Highlight relations when hovering over them in the raw membership dropdown list (close #2946) 2019-08-21 09:37:45 -05:00
Quincy Morgan 67afa20dc0 Let comboboxes filter against terms, not just values
Add terms property to fields
Make terms translatable for searchable fields
Account for fields' terms and keys when filtering with the Add field menu (close #5763)
2019-08-09 11:12:40 -05:00
Bryan Housel 48b1ddc925 Rename fetch to fetchComboData to not conflict with fetch API 2019-04-24 16:24:36 -04:00
Quincy Morgan 95f8ed9416 Fix issue where clicking the combobox caret would not open the dropdown 2019-02-19 09:46:39 -05:00
Bryan Housel a363f5175f Fix tabbing beyond last row of raw tag editor in Firefox
(closes #5847)

- removed the stopPropagation from the combobox keydown handler
  to make sure that the raw_tag_editor keydown handler will run

- increased timeout from 1ms to 10ms for Firefox
  This is related to Firefox's newish time budgeting approach that they
  started using around Firefox 55.  As a result, very fast timers (<4ms?)
  may run synchronously instead of yielding and running asynchronously
  https://blog.wanderview.com/blog/2017/03/13/firefox-52-settimeout-changes/

  (note similar code in ui/fields/combo.js to delay focus changes and
  redraws 10ms after the tag changes and other events have completed)
2019-02-07 15:56:49 -05:00
Bryan Housel 640730d38b Change focus to existing key instead of suffixing it with _1
(re: #3625, re: #2896)
2019-02-06 10:29:09 -05:00
Bryan Housel af8fb1d758 Show combobox if we are moving from a different active combobox
(closes #5752)

Previously it would go down the `hide()` branch anytime an existing combobox
was active.
2019-01-28 16:22:37 -05:00
Bryan Housel 87ddfa68dc Revert 55715a482 - caused raw_tag_editor combos to not blur in Safari 2019-01-28 11:20:32 -05:00
Bryan Housel b9444ab991 Restore hand cursor on dropdown carat
(closes #5769)

This change allows pointer events to flow to the caret, and forwards
them back to the combo input.  Also renames several event handlers
for clarity, and increases the double-click detection threshold.
2019-01-26 13:22:31 -05:00
Bryan Housel 18d71448be pacify eslint 2019-01-25 16:23:46 -05:00
Bryan Housel 55715a4827 Try to dispatch an accept event on blur
(re: #5752 - but does not close it)
2019-01-25 14:47:17 -05:00
Bryan Housel 4583e2d4d7 Make sure all combo event listeners can handle accept/cancel w/o datum
(re: #5637, re: #5618)

This can happen if the user enters a value that is not matched to
one of the combo suggestions.

Also make sure to set `this` to the input field.  It might not be
already if the event was triggered from a keypress instead of a click.
2019-01-22 23:14:34 -05:00
Bryan Housel 0c7b9a631e Improve combobox event handling and avoid overwriting typed data
(closes #5722, re: #5637, re: #5618)

dispatched with a value() string instead of a datum, which
causes issues for code expecting a datum always.
(such as localized.js brand picker or "Add Field" combo)

Fix for this coming in next commit.
2019-01-22 22:26:27 -05:00
Bryan Housel 1ec5b708fc Restore default click behaviors on mousedown of a combobox
(closes #5732)
2019-01-18 23:23:35 -05:00
Bryan Housel 5f2d80c7a6 pacify eslint 2019-01-08 10:58:47 -05:00
Bryan Housel 4f0a608439 Merge pull request #5637 from openstreetmap/5618
fix autocomplete combobox bug
2018-12-26 15:15:29 -05:00
Max Grossman e3407d4168 do not use mouseover, use mousedown!
ref #5596
2018-12-20 09:05:23 -05:00
Max Grossman 2dab19e9ae default to value() if neither d and choice are null in the accept function
ref #5618
2018-12-20 08:52:16 -05:00
Max Grossman 5a1dfeec72 open combobox if anywhere on box clicked...
ref #5596
2018-12-20 08:47:37 -05:00
Bryan Housel e08bfb2add Simplify accept/cancel event dispatchers, store datum in _choice 2018-12-12 15:26:18 -05:00
Bryan Housel fc1f7e4d46 Trigger a change event when accepting combo option with return, tab
(closes #4900, closes #5449)

Some browsers need an explicit `change` event triggered on the input field
when a value has been changed by the combo and accepted by pressing return
or tab.  This was only an issue on combos that aren't part of uiFields,
since the uiFields are all setup to respond to `change`,`input`,`blur` etc.
2018-12-11 23:25:47 -05:00
Bryan Housel 39b3f1df68 Avoid creating comboboxes
(closes #5568)

Several strategies in here:
- Move uiCombobox() from inside the render function to class variable
- Don't render stuff like the raw tag editor when it's collapsed
- Don't show as many fields/combos on hover
- Don't instantiate fields (like universal/more) until they're actually shown
- Bind the combo on enter selection not on update selection
2018-12-11 16:07:00 -05:00
Bryan Housel 6732ca6eda Comboboxes no longer show on focus.. update tests 2018-12-11 01:19:51 -05:00
Bryan Housel ff646fa2c8 Dispatch a 'cancel' event if the user hits escape 2018-12-11 00:09:55 -05:00
Bryan Housel 6cf1d63b48 Make sure dropdown doesn't remain visible
(closes #5575)

Also improves keyboard navigation, and adds some scrollintoview
workarounds to make sure that the selected option is visible
while also not causing the whole page to move.
2018-12-10 23:54:06 -05:00
Bryan Housel 15a54cab17 Use context.container instead of passing it in 2018-12-10 14:14:27 -05:00
Bryan Housel e5dedeff8b Move lib/d3.combobox.js -> ui/combobox.js
As with other things from this lib/ folder, little original code remains
and turning these things into reusable d3 plugins is not a priority.
2018-12-10 12:38:21 -05:00