Skip to content

Conversation

@BrianJavier99
Copy link
Contributor

@BrianJavier99 BrianJavier99 commented Apr 17, 2025

Description

I have added a functionality that allows direct editing of the labels by clicking them when allowAdditions is set to true.
The expected behavior is as follows:

  • All behaviors detailed below will only trigger if allowAdditions is set to true.
  • Clicking anywhere inside the item (except for the close icon) will trigger the edit functionality.
  • When edit functionality is triggered, the close icon will disappear, and the keypress events for the Del and Backspace keys are also ignored to prevent accidental deletion of the item.
  • To save changes, one has to click outside of the element to trigger the blur, or press Enter key.
  • If editing a selected item that is not added by the user, what goes behind the scenes is that the non-addition item will get unselected, and a new item will be added to the selection, which is now considered a user addition. This means that the non-addition item will appear back to the dropdown menu.
  • When editing an existing item while having a value at the search input at the same time, pressing Enter key would only save the changes made to the existing item.
  • When editing an existing user-added item, if the new value matches one of the unselected menu items, that menu item will be have the class "filtered" added to it, making it disappear in the selection.
  • The changes made when editing item labels reflect in the dropdown's hidden input value.

Testcase

https://jsfiddle.net/ReiVanBjair/a37v91gb/15/

Screenshot (if possible)

image
image
image
image
image

Closes

#3232

@BrianJavier99 BrianJavier99 marked this pull request as ready for review April 17, 2025 16:49
@ko2in ko2in added type/feat Any feature requests or improvements state/awaiting-reviews Pull requests which are waiting for reviews labels Sep 26, 2025
@ko2in
Copy link
Member

ko2in commented Sep 26, 2025

@BrianJavier99 Looks great 👍

I think it's more effective to bind the escape key for canceling edits. And, the text box design could use a minor tweak; perhaps we could remove the background and padding from the container. This way, leaving the text box by itself would improve both spacing and the editing experience. 🤔

FUI-Editing-Dropdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state/awaiting-reviews Pull requests which are waiting for reviews type/feat Any feature requests or improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants