At least 40 years, since it was already present in Windows 1.0 (see https://www.youtube.com/watch?v=S-SuAaYDZIk for an example).

The original Macintosh software also did this, back in 1984.

From the Apple Human Interface Guidelines, published in 1986: "The application dims an item when the user can't choose it. If the user moves the pointer over a dimmed item, that item isn't highlighted."

There may well have been prior art, but that's as far back as my knowledge goes.