Add event listener for tab changes