Press the black key between F and G. What did you play, F sharp or G flat? The honest answer: both. Same pitch, same string, same frequency, two names. Notes like these are called enharmonic equivalents.
Because scales are spelled like sentences, and every letter wants to appear exactly once. The F# major scale is written F# G# A# B C# D# E#, one of each letter from A to G. If we wrote Gb instead of F#, the same scale would need to reuse letters and reading it would become a puzzle. So the name is chosen to keep the spelling clean, not because the sound changes.
Yes, E# is just F. But inside F# major, the 7th note must be some kind of E, because the letter E has not been used yet. Write F and you suddenly have two F letters in one scale. Music notation chose consistency over familiarity, and honestly, it was right.
The detector compares pitches, not names. Press D# and it will happily match scales that call that note Eb. You never have to think about spelling while playing; the naming only matters when you write music down for someone else to read.