1.17, 1.17.1 Pre-release 1
Windows 10 Minecraft Java Edition Release 1.16.5
So, it appears that if you have weakness, and you hold an item that does less then 8 damage, you cant do damage with that item, as expected, but, if you use an item that does more then 8 damage, like an axe. Then you have your fist out, then swap to the axe, instantly left click, then immediately swap to the item you want to use (that is under the 8 damage weakness amount) and click again, you can do damage and use the enchantments of the item. Not sure why or how this works.
How to reproduce.
(All these items can be replaced by other items and different locations in hotbar)
Type /effect give @a weakness 1000 1
Put a netherite sword with fire aspect in slot 1
Put a stone axe in slot 2
Switch to slot 3 (fist)
Start spam clicking towards an entity
Press 2 and then 1 very quickly
If you get the timing right, you should light the entity on fire.
MC-28289 Switching items at the same time as attacking ignores the item attributes