Prefer left clicks over right clicks in ambiguous situations
This swaps the order in which buttons are checked when a click occurs on a clickpad, so that when both the left and right buttons are touched when the click is performed, and middle button emulation is disabled, a left click occurs instead of a right click.
Given that left clicks are much more common than right clicks, I think it makes sense to prefer left clicks over right clicks in case of ambiguity. Additionally, left clicks are usually less intrusive than right clicks due to right clicks frequently opening context menus that then need to be closed, whereas left clicks will usually do nothing or move the text cursor in a text editor.
Ideally, this probably should be caught by palm rejection (which does seem to work fine for me except for clicks), but this does a pretty good job at mitigating the issue.
On my laptop, I have an issue with unwanted secondary/right clicks when doing a regular primary/left click. What happens is that my palm will slightly hit the bottom right corner of the touchpad when performing a normal click with my thumb on the left side of the touchpad. This creates an ambiguous situation where libinput registers a touch on both sides of the bottom area of the touchpad, and as a result, sends a right click. On my particular laptop (WinBook CW140, MicroCenter's store brand), the touchpad placement makes it happen frequently enough for me to feel the need to patch it.
Steps to reproduce the issue
The issue I'm describing can be reproduced by simply putting a finger on both bottom sides of a clickpad with a dedicated bottom click area, and clicking on the left side of it. Because of the right touch being present, it will always perform a right click.
Swapping this behavior will likely just shift the issue to left-handed people instead of right-handed people. A potential improvement on this would be to take into account the user's handedness to detect which side should be prefered over the other.
Other Potential Solution
Given this is an ambiguous situation, another option could be to drop the click entirely, and have the user repeat their action in a way that is not ambiguous. However, I feel this behavior might end up being more confusing when the