In other words, add class 'active-trail' to a menu item if the item and a node being viewed have common URL paths. This is to indicate that the node is a child of the menu item.
In order to achieve that one would use, for example, Menu position or Context module. As those are a bit complex modules useful for doing more complex and rather multiple tasks, it would be an overkill here so, in our case, the Menu Trail By Path (MTBP) module is just a perfect fit to accomplish this simple, yet appearing so very complicated to many, job. Its file size is very small compared to the other ones' and it has versions for both Drupal 7 and Drupal 8. There is a great thing about this module - it works out of the box which means there is no need for any configuration - just install, enable and voila, you are done! It works beautifully with properly configured Pathauto module, however. It is worthwhile to mention that the MTBP also enables breadcrumb handling.
That being said I assume your site is already equipped with the Pathauto module. If not, install, enable and configure Pathauto module first, then do the same with the MTBP module (except for the configuration of course). There is a great video tutorial on YouTube, by Scott Tolinski from Level Up Tutorials, on how to configure the Pathauto module.
So, if you still rack your brain 'Why the heck the menu item doesn't get highlighted, the paths are the same indeed', there is no need for deep research. You will only need these two modules:
- Pathauto with its dependencies - Token and CTools
- Menu Trail By Path without contributed dependencies or configuration.
Thank you for reading and if you find this article helpful feel free to share it.