An electronic faucet includes a spout assembly and a controller configured to control the flow of water through the spout assembly in response to the position of a spray head. A sensor may be positioned to detect an object in a detection zone near the faucet. The controller may disable the sensor upon the spray head being uncoupled from the spout.