mdn / content

The content behind MDN Web Docs
https://developer.mozilla.org
Other
9.18k stars 22.47k forks source link

onXYZ hard to search after event refactoring #18354

Open teoli2003 opened 2 years ago

teoli2003 commented 2 years ago

Extracted from #18353

"Also want to mention that, with the recent GlobalEventHandlers demixing effort, the onxxx handlers are becoming increasingly hard to search. I literally searched for onclick and the only thing that came up was SVG onclick attribute which is not useful—even misleading—to users. I don't even know what to link to in these pages."

cc/ @queengooborg @elchi3 (something to look at once GEH is done)

queengooborg commented 2 years ago

@Josh-Cena This actually seems to be an issue beyond the removal of GEH, as we're combining event and event handler pages in general, but I can see how GEH's removal worsens the situation.

I wonder if we can somehow tweak the search so that any searches for onXXX will also include results for XXX event?

Josh-Cena commented 2 years ago

That would definitely work for me.

Elchi3 commented 2 years ago

Should this be a Yari search issue then?

I think to some extent we made a conscious choice to de-emphasize onXYZ so that people use them less and prefer addEventListener and friends.

Of course, if we still have onClick and other onXYZ pages, these pages should get updated, too, so they don't become the primary search target. So some content work here could be to check what those pages are and update them or at least add hints where to find the "click" event documentation, etc.

Josh-Cena commented 2 years ago

I think to some extent we made a conscious choice to de-emphasize onXYZ

Yes, that makes sense. However, as someone new to web APIs but with some knowledge of the features available, the first thing that comes to my mind when thinking about "click handler" is onClick (well—since React calls it onClick, I never developed the idea that addEventListener is what I should use). But the search results for "onclick" are pretty much all gibberish. While we may demote the onClick pages, is it also possible to make addEventListener show up when searching for onClick? (Sounds like a demand that doesn't generalize, but that's just my wish)