How did you create an account? You only need the password if you are getting the keys from the JSON backup file.
Your JSON backup file is named like this: your_account_address.json. Unlike your mnemonic phrase, your JSON backup file is password-protected. It has all the information to restore your account, but you cannot just read it because it is encrypted for safety. To restore your account with the JSON backup file, you need to have both the file and the password to decrypt
And this is why Polkadot UI is asking it because is not storing the keys or the mnemonic.
In PolkadotJS you can recover the keys from the JSON and sign a message/transaction like this:
import keyring from '@polkadot/ui-keyring';
import { cryptoWaitReady } from '@polkadot/util-crypto';
async function keys() {
// before sr25519 can be used, the WASM libraries needs to be loaded and initialized
await cryptoWaitReady();
// load all available addresses and accounts
keyring.loadAll({ ss58Format: 42, type: 'sr25519' });
const pairFromJSON = keyring.createFromJson(your_json);
//Check your address
console.log(pairFromJSON.address);
// decrypt it
const keys = keyring.addPair(pairFromJSON, 'myStr0ngP@ssworD');
//Do a normal signature (You can sign an extrinsic too)
const signature = keys.pair.sign("message");
console.log(signature);
}