question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Doesn't mark the first item when the selected item is cleared by backspace

See original GitHub issue

Describe the bug The scenario is when the [clearOnBackspace]="true" [markFirst]="true" attributes are enabled. So when I clear the value using backspace, it behaves as expected. Which is, it clears the input field and mark the first attribute in the dropdown. Now, I select a value from the dropdown below and focus out from the input field. Then I click on the input field and clear the selected item using backspace, it doesn’t mark the first one

Reproducible example Stackbiltz Example which reproduces described behavior

To Reproduce Steps to reproduce the behavior (if the example is not provided):

  1. Go to the given example
  2. Click on the select dropdown
  3. Scroll down and select a value
  4. Focus out from the select input field
  5. Again focus on the select input field
  6. clear the selected item using backspace
  7. Can observe the issue the first item is not marked but the previously selected item

Expected behavior On the 7th step, mark the first item in the dropdown

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser - chrome, firefox, edge
  • Version - 73.0.3683.86 (Official Build) (64-bit), 66.0.2 (64-bit), 44.17763.1.0 respectively

Smartphone (please complete the following information):

  • Didn’t test

Additional context The expected behavior happens when the selected item is cleared using the clear/close icon though

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
varnastadeuscommented, Jun 27, 2019

This should work:

const [first] = select.itemsList.filteredItems;
select.itemsList.markItem(first);
// to scroll
select.dropdownPanel.scrollTo(first);
1reaction
varnastadeuscommented, Jun 27, 2019

the intention of [markFirst] was to continue from last selection/first item when opening the dropdown. While dropdown is opened marked item stays in the same position. This is by design and otherwise, the user will get unexpected scrolls which will result in bad UX.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Removing value by backspace in RadCombobox
Hello, I have a load on demand radcombobox inside a Ajax panel. When the submitt button is clicked after making a selection and...
Read more >
Detect backspace Event in UITextField - ios
This answer is dangerously wrong and should be avoided. The specific return value of strcmp (other than its sign) is meaningless. The string...
Read more >
Delete selected item using the backspace key in windows.
Delete selected item using the backspace key in windows. ⁠— Right-Click Select. Delete selected item using the backspace key in windows. Out of...
Read more >
Why doesn't the backspace key work in insert mode?
Each item allows a way to backspace over something: value effect indent allow backspacing over autoindent eol allow backspacing over line breaks ...
Read more >
Delete & Backspace keys are not working in Excel (Desktop
Backspace clears the content of the active cell i.e., it only can clear the first cell where we start selecting. In other Office...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found