Is there a way to stop the quantity selector increasing past the available quantity?

the quantity selector on the collection page just keeps going, even though, in this example, only 1 is available.

Is there a way to constrain it to not going past the max quantity? Just like every other website manages to do?