Skip to content

Add Autocomplete component #562

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

Closed
wants to merge 5 commits into from
Closed

Add Autocomplete component #562

wants to merge 5 commits into from

Conversation

mrholek
Copy link
Member

@mrholek mrholek commented Jul 27, 2025

No description provided.

indicator.tabIndex = -1;
}
buttons.append(indicator);
this._indicatorElement = indicator;

Check warning

Code scanning / CodeQL

Useless assignment to property Warning

This write to property '_indicatorElement' is useless, since
another property write
always overrides it.

Copilot Autofix

AI 1 day ago

To fix the problem, remove the redundant assignment to this._indicatorElement on line 520 in the _createButtons method of js/dist/auto-complete.js. Only the second assignment (line 521) should remain, as it is sufficient to set the property. No other changes are needed, and no imports or definitions are required. The fix is a simple deletion of the first assignment.

Suggested changeset 1
js/dist/auto-complete.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/js/dist/auto-complete.js b/js/dist/auto-complete.js
--- a/js/dist/auto-complete.js
+++ b/js/dist/auto-complete.js
@@ -520,3 +520,2 @@
         this._indicatorElement = indicator;
-        this._indicatorElement = indicator;
       }
EOF
@@ -520,3 +520,2 @@
this._indicatorElement = indicator;
this._indicatorElement = indicator;
}
Copilot is powered by AI and may make mistakes. Always verify output.
const selects = SelectorEngine.find(SELECTOR_AUTO_COMPLETE);
for (let i = 0, len = selects.length; i < len; i++) {
const context = Data.get(selects[i], DATA_KEY);
({

Check warning

Code scanning / CodeQL

Expression has no effect Warning

This expression has no effect.

Copilot Autofix

AI 1 day ago

To fix the issue, the no-op expression should either be removed entirely or replaced with meaningful code if it was intended to serve a specific purpose. Since there is no indication of its intended use, the safest approach is to remove it. This will clean up the code and eliminate the unnecessary expression without altering the existing functionality.


Suggested changeset 1
js/dist/auto-complete.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/js/dist/auto-complete.js b/js/dist/auto-complete.js
--- a/js/dist/auto-complete.js
+++ b/js/dist/auto-complete.js
@@ -773,5 +773,3 @@
         const context = Data.get(selects[i], DATA_KEY);
-        ({
-          relatedTarget: selects[i]
-        });
+// Removed no-op expression
         if (event && event.type === 'click') ;
EOF
@@ -773,5 +773,3 @@
const context = Data.get(selects[i], DATA_KEY);
({
relatedTarget: selects[i]
});
// Removed no-op expression
if (event && event.type === 'click') ;
Copilot is powered by AI and may make mistakes. Always verify output.
indicator.tabIndex = -1;
}
buttons.append(indicator);
this._indicatorElement = indicator;

Check warning

Code scanning / CodeQL

Useless assignment to property Warning

This write to property '_indicatorElement' is useless, since
another property write
always overrides it.

Copilot Autofix

AI 1 day ago

To fix the issue, we should remove the redundant assignment this._indicatorElement = indicator on line 559. This will eliminate the unnecessary operation without affecting the program's functionality, as the second assignment on line 560 already sets the correct value.


Suggested changeset 1
js/dist/autocomplete.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/js/dist/autocomplete.js b/js/dist/autocomplete.js
--- a/js/dist/autocomplete.js
+++ b/js/dist/autocomplete.js
@@ -559,3 +559,2 @@
         this._indicatorElement = indicator;
-        this._indicatorElement = indicator;
       }
EOF
@@ -559,3 +559,2 @@
this._indicatorElement = indicator;
this._indicatorElement = indicator;
}
Copilot is powered by AI and may make mistakes. Always verify output.
if (composedPath.includes(context._element)) {
continue;
}
({

Check warning

Code scanning / CodeQL

Expression has no effect Warning

This expression has no effect.

Copilot Autofix

AI 1 day ago

To fix the issue, the object literal { relatedTarget: context._element } should either be removed entirely or replaced with meaningful code if it was intended to serve a specific purpose. If the expression was meant to document the structure of an object, it should be assigned to a variable or used in a function call. Alternatively, if the value is deliberately ignored, it should be wrapped in a void expression to clarify intent.

In this case, since the object literal does not appear to serve any purpose, the best approach is to remove it entirely. This ensures the code remains clean and avoids confusion.


Suggested changeset 1
js/dist/autocomplete.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/js/dist/autocomplete.js b/js/dist/autocomplete.js
--- a/js/dist/autocomplete.js
+++ b/js/dist/autocomplete.js
@@ -832,5 +832,3 @@
         }
-        ({
-          relatedTarget: context._element
-        });
+        // Removed unused object literal
         if (event.type === 'click') ;
EOF
@@ -832,5 +832,3 @@
}
({
relatedTarget: context._element
});
// Removed unused object literal
if (event.type === 'click') ;
Copilot is powered by AI and may make mistakes. Always verify output.
}

buttons.append(indicator)
this._indicatorElement = indicator

Check warning

Code scanning / CodeQL

Useless assignment to property Warning

This write to property '_indicatorElement' is useless, since
another property write
always overrides it.

Copilot Autofix

AI 1 day ago

To fix the issue, we should remove the redundant assignment this._indicatorElement = indicator on line 627. This will eliminate the unnecessary code and ensure that the property is only assigned once, on line 628. This change does not affect the functionality of the code, as the first assignment is immediately overwritten.


Suggested changeset 1
js/src/autocomplete.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/js/src/autocomplete.js b/js/src/autocomplete.js
--- a/js/src/autocomplete.js
+++ b/js/src/autocomplete.js
@@ -627,3 +627,2 @@
       this._indicatorElement = indicator
-      this._indicatorElement = indicator
     }
EOF
@@ -627,3 +627,2 @@
this._indicatorElement = indicator
this._indicatorElement = indicator
}
Copilot is powered by AI and may make mistakes. Always verify output.
@mrholek mrholek closed this Jul 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant