Feat: Click to switch features that are crossing ways#11346
Feat: Click to switch features that are crossing ways#11346Waqibsk wants to merge 6 commits intoopenstreetmap:developfrom
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.
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. |
modules/validations/crossing_ways.js
Outdated
| @@ -531,6 +587,7 @@ export function validationCrossingWays(context) { | |||
| .append('div') | |||
| .attr('class', 'issue-reference') | |||
| .call(t.append('issues.crossing_ways.' + crossingTypeID + '.reference')); | |||
|
|
|||
There was a problem hiding this comment.
do we need that new empty line?
modules/validations/crossing_ways.js
Outdated
| feature: utilDisplayLabel(entity1, graph, featureType1 === 'building'), | ||
| feature2: utilDisplayLabel(entity2, graph, featureType2 === 'building') | ||
| }) : ''; | ||
| return entity1 && entity2 |
There was a problem hiding this comment.
it seems that something weird went with indentation here
matkoniecz
left a comment
There was a problem hiding this comment.
no proper code review yet (but I spotted some very minor things - given how long PR waited I can also fix them myself), but I tested and it works beautifully - thanks!
interesting, seemed to work entirely fine in my testing |
|
yeah it works fine, but iirc, the only purpose of #11347 was to make the implementation in this PR cleaner |
and it can be now done here! |
05f53d6 to
9f7bd1b
Compare





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:
