Unity UI Mouse + Keyboard navigate, Un-Highlight button choice on mouse over

Hi,

I have Mouse + Keyboard navigation in menu. I use sprite swapping transition to show different button sprite when the button is highlighted. (For example Unselected = black, Selected = White)
Now the problem I have run into is that if one button is active for keyboard controls, and considered selected and thus has selected sprite as button background, and I hover mouse over different button. Both buttons are considered “Active” and both have selected sprite as button background.

Is there any fix to this problem?

Thanks in advance

I found a workaround for navigation buttons. Attach the script below to each navigable button. More details on this forum post.

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
 
 
[RequireComponent(typeof(Selectable))]
public class HighlightFix : MonoBehaviour, IPointerEnterHandler, IDeselectHandler
{
    public void OnPointerEnter(PointerEventData eventData)
    {
        if (!EventSystem.current.alreadySelecting)
            EventSystem.current.SetSelectedGameObject(this.gameObject);
    }
 
    public void OnDeselect(BaseEventData eventData)
    {
        this.GetComponent<Selectable>().OnPointerExit(null);
    }
}

2021 that is still here(

2023 using Unity 2022.1.7f1, issue still exists and this work around still works thankfully! Thank you!