Apple - Can I use Shift, Alt and Control Modifier Keys Together With the Function Keys on the Touch Bar?

As @Patrick mentions in his answer, one cause of this problem is Karabiner-Elements not enabling the Touch Bar "keyboard" by default. The solution is to enable that keyboard in Karabiner-Elements Preferences (Vendor ID 1452, Product ID 34304) as shown in following screenshot:

enter image description here

I filed Touch Bar keyboard should be enabled by default · Issue #1700 · tekezo/Karabiner-Elements to request it be enabled by default in Karabiner-Elements.

More information in the following comments:

  • https://github.com/tekezo/Karabiner-Elements/issues/535#issuecomment-350522019
  • https://github.com/tekezo/Karabiner-Elements/issues/535#issuecomment-350597725

Ah, after some digging, I found out it's the fault of Karabiner Elements, a utility program I'm using to reassign some keys.

https://github.com/tekezo/Karabiner-Elements/issues/435