Fomantic-ui: [Search] Redundant page navigation on click

Created on 24 Aug 2020  路  2Comments  路  Source: fomantic/Fomantic-UI

Bug Report

When clicking on a search result with an url a redundant page navigation is made in javascript code.
The navigation triggered by javascript is then cancelled (overruled) by the regular navigation behavior of the a-tag.

Note that this only happens when clicking the search result. When pressing enter while the search result is in focus everything works as expected.

Steps to reproduce

  1. Open https://fomantic-ui.com/modules/search.html#/examples
  2. (Open network tab of dev tools and make sure to check the Preselve log option)
  3. Type "fomantic" in the Search GitHub input (the first example on that page)
  4. Click on the first search result

Expected result

The browser should navigate to the chosen github project. No redundant navigations should be made (no cancelled reuqests in network tab).

Actual result

One redundant navigation request is made.

Testcase

Screenshot (if possible)

image

image

Version


2.8.6

lanjavascript typbug

Most helpful comment

Fixed by #1653
Try here https://jsfiddle.net/lubber/nf8321pc/2/

All 2 comments

I confirm that it's a bug. The onSelect opens the URL via window.open or window.location.href if the href attribute is set for search item. Since it's an anchor tag, it has already default behavior to open the link which causes the simultaneous requests by both onSelect callback and click events. The default events should be prevented if the link is opening by windows.location.href or window.open.

Fixed by #1653
Try here https://jsfiddle.net/lubber/nf8321pc/2/

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davekc picture davekc  路  4Comments

murbanowicz picture murbanowicz  路  5Comments

ocharles picture ocharles  路  4Comments

hammy2899 picture hammy2899  路  5Comments

lubber-de picture lubber-de  路  4Comments