Automatic tags

Your task is to implement an input for adding tags.

Requirements:

  • By default, the input should be empty, and there should be no tags.
  • Pressing Enter should add a new tag and clear the input. The input should remain focused.
  • If the input is empty or contains only spaces, do nothing.
  • Pressing Backspace should remove the latest tag, but only if the cursor is at the beginning of the input. If the cursor is not at the beginning, it should simply remove the previous character (it's the default behavior).
  • Display tags in proper order. The most right tag is the most recent.

You are free to add classes, styles, ids, but don't edit or remove data-test attributes.
Create an account to start coding
Create account