The 'WiFi Only' mode only checks whether 'WiFi' is connected or not. If WiFi is detected as connected, it will tell Android to start downloading. Most phones can only turn on one network at a time, either 'WiFi' or 'Mobile data'.
Or even if both are turned on at the same time, Android will give priority to WiFi only and not consume mobile data.
But only a few devices can turn on both WiFi and mobile data at the same time (which is called Dual Wi-Fi acceleration). In this scenario, the app will check if the WiFi is connected or not only and tell Android to start downloading. Then your device will start downloading.
In this above case ,If you connect to WiFi and the WiFi internet is not working, then your device will use mobile data for downloading. (So there is no option for us to stop downloading over mobile data if both WiFi and Mobile Data are connected. Everything is managed by your phone manufacturer, so the behavior will vary from device to device.)