Skip to content

Conversation

@K-Tone
Copy link
Collaborator

@K-Tone K-Tone commented Dec 9, 2025

Description

This PR aims at fixing the following problem with empty entries in the input control list that is better illustrated by a gif below. Practically, many of the mouse buttons will add an extra empty line:

62d4ef3cfa9813e51ec37bb7716e0f9c

The reason that happens is that we somehow have both searchable and not searchable advanced drop-down items for mouse in the list. The non-searchable have no name, and thus they're shown as empty lines.

In this PR I opted for not populating the drop-down hierarchy with search results that are non-searchable for whatever reason.

Case ISXB-1677

Testing status & QA

After fixing, I've basically followed the repro steps to make sure the problem is no longer there. I have a mouse with side buttons so it's easier to check on my end.

Overall Product Risks

  • Complexity: Low
  • Halo Effect: Low

Comments to reviewers

Please describe any additional information such as what to focus on, or historical info for the reviewers.

Checklist

Before review:

  • Changelog entry added.
    • Explains the change in Changed, Fixed, Added sections.
    • For API change contains an example snippet and/or migration example.
    • JIRA ticket linked, example (case %%). If it is a private issue, just add the case ID without a link.
    • Jira port for the next release set as "Resolved".
  • Tests added/changed, if applicable.
    • Functional tests Area_CanDoX, Area_CanDoX_EvenIfYIsTheCase, Area_WhenIDoX_AndYHappens_ThisIsTheResult.
    • Performance tests.
    • Integration tests.
  • Docs for new/changed API's.
    • Xmldoc cross references are set correctly.
    • Added explanation how the API works.
    • Usage code examples added.
    • The manual is updated, if needed.

During merge:

  • Commit message for squash-merge is prefixed with one of the list:
    • NEW: ___.
    • FIX: ___.
    • DOCS: ___.
    • CHANGE: ___.
    • RELEASE: 1.1.0-preview.3.

if (!item.children.Any())
{
if (!item.IsSeparator())
if (!item.IsSeparator() && item.searchableName.Length > 0)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's it basically. We would like not to search in non-searchable items because they end up as empty lines in the displayed list in the end.

@K-Tone K-Tone marked this pull request as ready for review December 9, 2025 09:01
@u-pr-agent
Copy link
Contributor

u-pr-agent bot commented Dec 9, 2025

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪

The PR contains a very small, localized change (one line modification) to filter out empty items, which is easy to verify.
🏅 Score: 90

The change addresses the issue described effectively. However, relying on `.Length` without a null check is slightly risky if the string property is not guaranteed to be non-null.
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Potential NullReferenceException

The code checks item.searchableName.Length > 0. If searchableName can be null, this will throw a NullReferenceException. It is safer to use !string.IsNullOrEmpty(item.searchableName).

if (!item.IsSeparator() && item.searchableName.Length > 0)
  • Update review

🤖 Helpful? Please react with 👍/👎 | Questions❓Please reach out in Slack #ask-u-pr-agent

@u-pr-agent
Copy link
Contributor

u-pr-agent bot commented Dec 9, 2025

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Prevent NullReferenceException on searchableName

Accessing the .Length property on item.searchableName will cause a
NullReferenceException if the string is null. Using
!string.IsNullOrEmpty(item.searchableName) is safer and handles both null and empty
string cases.

Packages/com.unity.inputsystem/InputSystem/Editor/Internal/AdvancedDropdown/AdvancedDropdownDataSource.cs [121]

-if (!item.IsSeparator() && item.searchableName.Length > 0)
+if (!item.IsSeparator() && !string.IsNullOrEmpty(item.searchableName))
Suggestion importance[1-10]: 7

__

Why: Using string.IsNullOrEmpty is safer than checking .Length > 0, as accessing the property on a null string would throw a NullReferenceException.

Medium
  • More suggestions

🤖 Helpful? Please react with 👍/👎 | Questions❓Please reach out in Slack #ask-u-pr-agent

@K-Tone K-Tone changed the title don't add items that have no searchable name anyways FIX: Extra empty lines added in the control bindings drop-down for some mouse buttons Dec 9, 2025
@K-Tone K-Tone requested review from Pauliusd01 and ekcoh December 9, 2025 09:07
@codecov-github-com
Copy link

codecov-github-com bot commented Dec 9, 2025

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...nal/AdvancedDropdown/AdvancedDropdownDataSource.cs 0.00% 1 Missing ⚠️
@@           Coverage Diff            @@
##           develop    #2299   +/-   ##
========================================
  Coverage    77.95%   77.95%           
========================================
  Files          477      477           
  Lines        97416    97422    +6     
========================================
+ Hits         75943    75949    +6     
  Misses       21473    21473           
Flag Coverage Δ
inputsystem_MacOS_2022.3 5.54% <0.00%> (-0.01%) ⬇️
inputsystem_MacOS_2022.3_project 75.49% <0.00%> (-0.01%) ⬇️
inputsystem_MacOS_6000.0 5.32% <0.00%> (-0.01%) ⬇️
inputsystem_MacOS_6000.0_project 77.41% <0.00%> (-0.01%) ⬇️
inputsystem_MacOS_6000.2 5.32% <0.00%> (-0.01%) ⬇️
inputsystem_MacOS_6000.2_project 77.40% <0.00%> (-0.01%) ⬇️
inputsystem_MacOS_6000.3 5.32% <0.00%> (-0.01%) ⬇️
inputsystem_MacOS_6000.3_project 77.41% <0.00%> (-0.01%) ⬇️
inputsystem_MacOS_6000.4 5.33% <0.00%> (-0.01%) ⬇️
inputsystem_MacOS_6000.4_project 77.36% <0.00%> (-0.06%) ⬇️
inputsystem_MacOS_6000.5 5.33% <0.00%> (-0.01%) ⬇️
inputsystem_MacOS_6000.5_project 77.36% <0.00%> (-0.05%) ⬇️
inputsystem_Ubuntu_2022.3 5.54% <0.00%> (-0.01%) ⬇️
inputsystem_Ubuntu_2022.3_project 75.29% <0.00%> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.0 5.32% <0.00%> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.0_project 77.21% <0.00%> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.2 5.32% <0.00%> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.2_project 77.21% <0.00%> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.3 5.32% <0.00%> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.3_project 77.21% <0.00%> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.4 5.33% <0.00%> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.4_project 77.17% <0.00%> (-0.06%) ⬇️
inputsystem_Ubuntu_6000.5 5.33% <0.00%> (-0.01%) ⬇️
inputsystem_Ubuntu_6000.5_project 77.18% <0.00%> (-0.05%) ⬇️
inputsystem_Windows_2022.3 5.54% <0.00%> (-0.01%) ⬇️
inputsystem_Windows_2022.3_project 75.62% <0.00%> (-0.01%) ⬇️
inputsystem_Windows_6000.0 5.32% <0.00%> (-0.01%) ⬇️
inputsystem_Windows_6000.0_project 77.53% <0.00%> (-0.01%) ⬇️
inputsystem_Windows_6000.2 5.32% <0.00%> (-0.01%) ⬇️
inputsystem_Windows_6000.2_project 77.53% <0.00%> (-0.01%) ⬇️
inputsystem_Windows_6000.3 5.32% <0.00%> (-0.01%) ⬇️
inputsystem_Windows_6000.3_project 77.53% <0.00%> (-0.01%) ⬇️
inputsystem_Windows_6000.4 5.33% <0.00%> (-0.01%) ⬇️
inputsystem_Windows_6000.4_project 77.49% <0.00%> (-0.05%) ⬇️
inputsystem_Windows_6000.5 5.33% <0.00%> (-0.01%) ⬇️
inputsystem_Windows_6000.5_project 77.49% <0.00%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...nal/AdvancedDropdown/AdvancedDropdownDataSource.cs 0.00% <0.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Collaborator

@ekcoh ekcoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this. Change makes a lot of sense IMO.

@K-Tone K-Tone force-pushed the anthony/isxb-1677-mouse-bindings branch from 5ac5411 to 2acc063 Compare December 9, 2025 14:55
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.

3 participants