Skip to content

Fix "false" tooltip on access fields (fixes #12064)#12095

Open
Ashish-Ranjan-jpg wants to merge 5 commits intoopenstreetmap:developfrom
Ashish-Ranjan-jpg:fix-issue-12064
Open

Fix "false" tooltip on access fields (fixes #12064)#12095
Ashish-Ranjan-jpg wants to merge 5 commits intoopenstreetmap:developfrom
Ashish-Ranjan-jpg:fix-issue-12064

Conversation

@Ashish-Ranjan-jpg
Copy link
Copy Markdown

This PR fixes a bug where access fields (e.g., access, motor_vehicle, foot) show a literal string "false" in their tooltip when a single value is set.

The Problem

In modules/ui/fields/access.js, the logic for the title attribute used a logical && expression that returned a boolean false if the tag value was not an array (i.e., not a mixed selection). D3 then rendered this boolean as the string "false" in the HTML title attribute.

The Solution

Updated the logic to return undefined instead of false in those cases. Returning undefined correctly instructs D3 and the browser not to render a tooltip for single-selection tags, which matches the behavior of other fields in the iD editor.

Visuals

Before After
Screenshot 2026-03-24 152230 Screenshot 2026-03-25 011033

Testing

  • Local Verification: Tested in the browser at http://localhost:8080.
  • Single Selection: Confirmed the "false" tooltip no longer appears.
  • Mixed Selection: Confirmed the tooltip still correctly shows the list of unique values when multiple objects are selected.
  • Linting: Ran npx eslint modules/ui/fields/access.js and confirmed the file is clean.

fixes #12064

Comment thread modules/ui/fields/access.js Outdated
@tordans
Copy link
Copy Markdown
Collaborator

tordans commented Mar 25, 2026

Could you link / check the code for other fields eg the combo field and compare this part of the code. We should use the same style for both.

Refactor: Use ternary operator for access field tooltip title

Co-authored-by: Tobias <t@tobiasjordans.de>
@Ashish-Ranjan-jpg
Copy link
Copy Markdown
Author

Checked other fields and they seems to follow the same styling. Updated the radio.js to use undefined instead of null, and refactored the title attribute handling in the combo field to match the ternary pattern. Everything else appears consistent with the existing pattern.
I’ll commit these changes shortly.

@Ashish-Ranjan-jpg
Copy link
Copy Markdown
Author

@tordans I’ve addressed the suggested things, could you please take another look on it.

Copy link
Copy Markdown
Collaborator

@tordans tordans left a comment

Choose a reason for hiding this comment

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

Can only comment some more opinion on this. I don't do full reviews and cannot do merges here.

Comment thread modules/ui/fields/combo.js Outdated
}
return null;
})
.attr('title', d => d.isMixed ? t('inspector.unshared_value_tooltip') : (!['yes', 'no'].includes(d.state) ? d.state : undefined))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We don't use arrow functions (yet); not sure if we want to start here and now.
(There is discussion on if/when to use them in the future in a different thread.)
For me ternary operators work great of one level but the code before with two conditions was easier to read/understand.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Changed the arrow function back to the regular functions .
Yes, using ternary operator there made it bit uneasy to read, so changed it back with two conditions.
Please let me know if everything is ok now.

Comment thread package-lock.json Outdated
@@ -97,7 +97,7 @@
"svg-sprite": "2.0.4",
"typescript": "^5.9.3",
"typescript-eslint": "^8.56.0",
"vite": "^8.0.1",
"vite": "^7.3.1",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks like we are on vite 8 now, interesting https://github.com/openstreetmap/iD/blob/develop/package.json#L141
But this package lock change should not be in the PR AFAIK and IMO.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Staged the package-lock file unintentionally, reset it back to upstream/develop, now it is not in the "files changed" of this pr.

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.

bug in 2.39: 'false' when hovering over the access field

2 participants