MacOS – How to fix the OS X dictionary lookup feature for StackExchange comments in Google Chrome

dictionarymacos

When I use the "Look up word" right-click menu option on a StackExchange comment in OS X, the system selects other text and looks that up instead:

Step 1: select a word in a StackExchange comment to look up

select text

Step 2: right click & "Look up word"

right-click, "Look up _word_"

Step 3: watch OS X select some other text next to yours and look that up instead:

OS X selects other text and looks that up instead

  1. Why?

  2. How can I fix this?

I'm using OS X 10.10.5.

It appears to shift the selected text by 10 characters to the right in all cases, and happens in Chrome but not Safari.

Best Answer

Note: An update to the SE site (which I believe happened on July 18th, 2018) has fixed this problem—at least on all Stack Exchange sites. This issue is most likely still present on other sites, so this answer should still be useful.


I know some ways to get the dictionary to work for Stack Exchange comments (and a few other places I've seen this happen on the internet):

  • Hover over the word, and use control+command+D.

  • Three finger tap the word. (Make sure this is enabled, of course.)

  • (Stack Exchange specific) Browse Stack Exchange logged out.

As for why, I've mostly figured it out (finally). There are two lines in the source code (that only appear if you have privileges to upvote/flag):

<a class="comment-up comment-up-off" title="this comment adds something useful to the post">upvote</a>

<a class="comment-flag" title="Flag this comment for serious problems or moderator attention">flag</a>

However, the problem is resolved if you change those lines to:

<a class="comment-up comment-up-off" title="this comment adds something useful to the post"></a>

<a class="comment-flag" title="Flag this comment for serious problems or moderator attention"></a>