Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dropdown] API-driven dropdowns do not display placeholder on first render #2837

Open
jleahy opened this issue Jun 25, 2023 · 2 comments
Open
Labels
tag/next-release/nightly Any issue which has a corresponding PR which has been merged and is available in the nightly build type/bug Any issue which is a bug or PR which fixes a bug
Milestone

Comments

@jleahy
Copy link

jleahy commented Jun 25, 2023

Bug Report

When a dropdown configued to fetch its contents from an API endpoint and the placeholder is specified in javascript rather than HTML then the initial placeholder is not present. For non-API endpoints the behavior is correct. Calling the 'clear' behavior on the dropdown or clicking the 'x' on a clearable dropdown restores the placeholder. A functional workaround is to call clear immediately after the dropdown is initialized.

Steps to reproduce

  1. Define a dropdown in HTML as below:
<div class="ui search selection dropdown" id="xyz-dropdown">
  <i class="dropdown icon"></i>
  <div class="text"></div>
</div>
  1. Initialize the dropdown from javascript as below:
$('#xyz-dropdown').dropdown({
  clearable: true,
  match: 'text',
  placeholder: 'Select XYZ',
  apiSettings: {
    'url': '/api/blah/{query}',
  },
});
  1. Note that the placeholder ("Select XYZ") doesn't appear when the page renders.
  2. Call $('#xyz-dropdown').dropdown('clear')
  3. Note that the placeholder now appears.

Expected result

The placeholder is expected to appear on page load, as it does if the 'apiSettings' key is not present.

Actual result

The placeholder does not appear on page load.

Testcase

https://jsfiddle.net/ryf5b317/1/

Screenshot (if possible)

dropdown issue

Version

2.9.2

@jleahy jleahy added state/awaiting-investigation Anything which needs more investigation state/awaiting-triage Any issues or pull requests which haven't yet been triaged type/bug Any issue which is a bug or PR which fixes a bug labels Jun 25, 2023
@lubber-de lubber-de removed the state/awaiting-triage Any issues or pull requests which haven't yet been triaged label Jun 27, 2023
@mdrxy
Copy link

mdrxy commented May 7, 2024

Also having issues with this. Thank you for the temporary solution!

@lubber-de
Copy link
Member

Fixed by #3049
See your adjusted jsfiddle here https://jsfiddle.net/lubber/qkLs2xzp/1/

@lubber-de lubber-de added state/has-pr An issue which has a related PR open and removed state/awaiting-investigation Anything which needs more investigation labels May 11, 2024
@lubber-de lubber-de added this to the 2.9.4 milestone May 11, 2024
@lubber-de lubber-de added tag/next-release/nightly Any issue which has a corresponding PR which has been merged and is available in the nightly build and removed state/has-pr An issue which has a related PR open labels May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tag/next-release/nightly Any issue which has a corresponding PR which has been merged and is available in the nightly build type/bug Any issue which is a bug or PR which fixes a bug
Projects
None yet
Development

No branches or pull requests

3 participants