Listen for hash change events to update the active tab