As we discussed, the behaviors of the buttons are decided by your device, your driver, and your OS. It's not about if they work "well" or not - you can reflect them to "normal" keys and they will work as you expected, as Ben suggested, otherwise they are probably not recognized as a mouse click, because they may trigger os-level messages to the app, instead of being treated a normal button click inside the app.
Zotero is based on Firefox, but they're not the same. Also, website in Firefox are non-privileged while the Zotero main window is in a privileged environment, the behaviors can differ.
So if it's only your personal project and will not be used by others and you do want to capture these buttons in your code, try setting these two prefs to false:
mousebutton.4th.enabled
mousebutton.5th.enabled
Keep in mind that these settings can have unknown side affects and you should better not use them in projects that can be used by other people.