Safari Javascript disables F4 key I have a strange problem with my new MacBook Pro running Sierra.
After visiting some web sites (such as stackexchange, gmail, and web.whatsapp.com), the F4 key stops to work in all applications. All other function keys continue working normally, as well as starting launchpad (which is also on the F4 key). It seems pressing the F4 key does not generate any key code anymore, according to Key Codes.


This happens both with the internal MacBook keyboard as well as the apple wireless keyboard.
Logging out and logging in again (or rebooting) fixes the F4 key, only quitting Safari does not fix it.
Disabling Javascript (via Safari preferences) leaves the F4 key enabled.
Other browsers (Chrome, Firefox) are not affected by this issue.
It is a completely fresh installation of Sierra and happens without installing any additional programs or modifying any settings.  Tested with 10.12.2 and 10.12.3.


Did anyone notice the same issue?

Does anyone have an idea how to debug or prevent this issue?

An easy way to test if you have this issue is by: 


Log in.
Start the terminal.
Press Control-v and F4 in the terminal. It should print ^[OS.
Start Safari, go to stackexchange.com.
Repeat step 3, nothing gets printed on the terminal. Pressing Control-v and F3 still prints the correct code for F3, ^[OR.
Based on the info you've provided during our comments history, and the fact I couldn't replicate this issue on five separate computers, including three 2016 MacBook Pros running macOS Sierra 10.12.3, the only solution I have is to try a full reinstallation / test / update process.

IMPORTANT - Ensure you have a full backup before proceeding with these steps!


Shutdown your MBP
Switch on your MBP
Immediately press and hold the CommandR keys until you see the Apple logo appear
When you see the Utilities window appear, select Disk Utility and click on Continue
Select your MBP drive from the sidebar on the left
Click on the Erase button
Click on the Format drop-down list and select Mac OS Extended (Journaled)
Enter a name for your disk
Click Erase
When completed, Quit Disk Utility
Select Reinstall macOS from the Utilities window (do not choose the Restore from Time Machine Backup option)
Follow the instructions to reinstall macOS
When installation is complete and you have rebooted, follow the prompts to setup your MBP. However, do not choose to copy files or migrate any data from your backups. Instead, set the MBP up as a totally new computer.
When complete, test to see if your issue still persists
Assuming your issue is now resolved, use the Mac App Store to update macOS, Safari, etc. However, do not copy any of your backed up files yet.
Now test to see if your issue is still gone
If all is good, then copy your backed up data to your MBP again. You can do this by using Migration Assistant (located within the Utilities folder within your Applications folder).


NOTE - If your issue still persists at Step 14 (when you first test for it again) then go through the entire process again. However, this time at Step 3 hold the CommandOptionR keys instead so that you start up from Internet Recovery. This will take longer to do, but eliminates the possibilty of some random problem with the local Recovery partition.