-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Feat: Click to switch features that are crossing ways #11346
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
base: develop
Are you sure you want to change the base?
Feat: Click to switch features that are crossing ways #11346
Conversation
|
Functionally I think this is a good idea. Rapid has a „highlight on hover“ for their MapRoulette integration which I find even more useful because it does not change the current selection. I looked into this for #11310 but iD might be missing something to use this easily. Visually I think we should have a look if there is any existing „Text as action“ style that we can reuse like the blue color or something else. Semantically the span should be a button tag IMO. |
Yeah, that's it, thanks. Now that I think about it again, the different to Rapid was something else … but not relevant here.
👍
No, I was only referring to the semantics, not the visual representation, mainly from an accessibility and general clean-html point of view where actions elements should be either So +1 for the link style look of the second screenshot. |
tyrasd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Waqibsk . This is a good start. The following would be to be adjusted still:
- feature1 is already the selected feature, thus it does not need to be clickable
- as mentioned above: it would be better if the clickable part of feature2 is a
<a>element, instead of a custom styled<span> - currently, this only adds the link for the crossing ways validation. I believe other some of the other validation modules also have warnings involving more then one feature. Could you please add the same link also to those validators?
I noticed that the implementation is quite a bit more convoluted than expected (and using selection.html which should be avoided in general). I see why you chose to approach the implementation that way, as the localizer module did not have a functionality to accept a callback function to specify additional html markup for the replacement strings. I did now extend the functionality to add this missing functionality in #11347. Please take a look and rebase your PR on that branch, as it should allow you to greatly reduce the overhead in this PR. I think you should end up with something like the following:
return entity1 && entity2
? t.append('issues.crossing_ways.message', {
feature: utilDisplayLabel(entity1, graph, featureType1 === 'building'),
feature2: selection => selection
.append('a')
.classed('feature-link', true)
.text(utilDisplayLabel(entity2, graph, featureType2 === 'building'))
.click(…)
}) : '';
I think currently, the way iD handles |
True. But still: only the not already selected feature should be clickable, regardless of if it's the first or second feature. Should none of the selected features exactly match the current selection (e.g. when multiple features are selected), then both links can be clickable. |
this allows for example to make the replaced parts to use additional html markup:
```js
selection.call(t.append('stringId', {
key1: 'replacementString',
key2: sel => sel.append('a')
.attr('href', 'https://example.com')
.text(…);
})
```





Fixes #11328
This PR , turns the labels of the crossing features into a link which when clicked on would select that feature.
This makes it easier for users to navigate between crossing features.
Screenshot:
