Skip to content

Conversation

@bernhardoj
Copy link
Contributor

@bernhardoj bernhardoj commented Jun 3, 2025

Same root cause as Expensify/App#18480 and same solution too.

Related issue: Expensify/App#61622

Added Shift + ESC shortcut to the example app. Both ESC and Shift + ESC works fine.

w.mp4

@github-actions
Copy link
Contributor

github-actions bot commented Jun 3, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@bernhardoj
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

CLABotify added a commit to Expensify/CLA that referenced this pull request Jun 3, 2025
// https://github.com/Expensify/App/issues/18480
const strictIndex = _.findIndex(commands, item => (
(item.input === json.input && matchesModifierFlags(item))
((item.input === json.input || (matchesEscape(item))) && matchesModifierFlags(item))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This technically happens to every non single letter input, but I only added it for escape for now. Let me know if I should handle them all.

Copy link
Member

@s77rt s77rt Jun 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand the logic here. Why are item.input and json.input not equal? (and what are their values)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still trying to understand the bug. Here is what I think is going: After you press ESC, we look for an exact (strict) match and we fail and fallback for loose match and we end up with the listener for SHIFT + ESC (because it's somehow first in the list). Does that sound about right? If so I think we should add a condition to handle exact ESC key combination i.e.:

    const strictIndex = _.findIndex(commands, item => (
        (item.input === json.input && matchesModifierFlags(item))
        || (matchesEnter(item) && matchesModifierFlags(item))
        || (matchesEscape(item) && matchesModifierFlags(item))
    ));

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh it's exactly the same logic your are making XD

Can you just rewrite that way as I think it's a little more readable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, I'm trying to keep it short. Updated.

@bernhardoj
Copy link
Contributor Author

cc: @s77rt for review

@s77rt
Copy link
Member

s77rt commented Jun 3, 2025

cc @neil-marcellini please merge this

@neil-marcellini neil-marcellini merged commit f39fd73 into Expensify:main Jun 3, 2025
1 check passed
@os-botify
Copy link
Contributor

os-botify bot commented Jun 3, 2025

🚀 Published to npm in 1.0.14 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants