The `connected` handler appears to have some copy-paste code from the `attribute.change` handler which does not properly handle all modes. Also, consider changing the name of "programmatic" mode to "manual"