Use state flag to prevent unwanted tab clicks