Allow access to selected value in `submit` callback of `mp.input.select`
Open
Nobody has claimed this yet.
meta:feature-request
- Dominant language
- C
- Stars
- 37k
- Forks
- 3.5k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 22
Description
Expected behavior of the wanted feature
When items was changed in code(by swapping entry order etc), checking the selected value can be safer as it ignores the positions.
It can also reduce extra variable declaration if the selected value is needed in the submit action.
mp.input.select({
items: ['foo', 'bar'],
submit: function(id, value) {
// switch on id can be error-prone when `items` is changed
switch (id) {
case 1:
case 2:
}
// switch on value ignores the positional problem
switch (value) {
case 'foo':
case 'bar':
}
}
})
Alternative behavior of the wanted feature
No response
Log File
No response
Sample Files
No response
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the mp.input.select entry point and tracing how arguments are assembled for its submit callback. Update the callback contract to expose the selected value independently of item position, then verify the example’s value-based handling and existing selection behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100