{"id":16711214,"url":"https://github.com/cmditch/elm-msg-bug","last_synced_at":"2026-04-14T17:31:47.904Z","repository":{"id":86547405,"uuid":"371130108","full_name":"cmditch/elm-msg-bug","owner":"cmditch","description":null,"archived":false,"fork":false,"pushed_at":"2021-05-26T19:33:27.000Z","size":104,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-03T10:29:43.098Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elm","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cmditch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-26T18:17:14.000Z","updated_at":"2023-01-12T22:25:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"d6f5b62c-b5f0-42a1-8691-05b4c74c3af3","html_url":"https://github.com/cmditch/elm-msg-bug","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cmditch/elm-msg-bug","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmditch%2Felm-msg-bug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmditch%2Felm-msg-bug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmditch%2Felm-msg-bug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmditch%2Felm-msg-bug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cmditch","download_url":"https://codeload.github.com/cmditch/elm-msg-bug/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmditch%2Felm-msg-bug/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31808505,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T11:13:53.975Z","status":"ssl_error","status_checked_at":"2026-04-14T11:13:53.299Z","response_time":153,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T20:11:13.923Z","updated_at":"2026-04-14T17:31:47.898Z","avatar_url":"https://github.com/cmditch.png","language":"Elm","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Elm Msg mapping issue\nA basic multi-page SPA app SSCCE\n\n### What's happening here?\n\nI think Elm is mapping a `Msg` from the Home page into the `Settings` page.  \nThe compiler would recognize this as invalid, but the Elm runtime is allowing this.  \n\nSomething very relevant here: This is only reproducable in Chrome due to how \nthe `focusout` event is fired off once the DOM element is removed. Other browsers\ndo not behave this way. `preventDefaultOn \"mousedown\"` is very important as\nthis prevents the textfield from losing focus when `mousedown` hits the \"Go to Settings\" link.\n\n**Here is what I think the flow is:**\n1. Focusing `input` element causes `Note.Msg (EditorFocused True)`.\n2. Mousedown on \"Go to Settings\" link causes `Note.Msg NoOp` to fire. Input still has focus.\n3. Mouseup on link causes the page to change to `/settings`.\n4. The `input` is removed from the DOM on page change and the `focusout` event is fired (only in Chrome).\n5. `EditorFocused False` is fired but caught by `Settings.Msg`\n6. The settings update function does not recognize the `EditorFocused` Msg, \nbut the way the Elm compiler generates the final match in a case statements results in the Msg being caught in the `default` case,\naka `TheDefaultCase { wat : { hereIsAnElmException : Int } }`\n7. The code attempts to access `constructorValue.wat.hereIsAnElmException`.\n`constructorValue` is actually a `Boolean` off of `EditorFocused` so an exception is thrown.\n\n![image](https://user-images.githubusercontent.com/15849320/119717049-10cdfd00-be23-11eb-8d71-b83c0c9fb507.png)  \n\n\n**Note:** If you disable the offending code in `Settings` under `Msg.TheDefaultCase`, you an invalid `Msg` type propagating to `Settings.update`\nScreen Shot 2021-05-26 at 1.28.36 PM![image](https://user-images.githubusercontent.com/15849320/119720147-d8c8b900-be26-11eb-863c-f97d76acc805.png)\n\n\n### Run\n1. Install deps and start dev server\n```\nyarn install\nyarn dev\n```\n2. Open http://localhost:1234 **in Chrome**\n3. Click into textfield.\n4. Click \"Go to Settings\" link.\n5. Look at console for the exception.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmditch%2Felm-msg-bug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcmditch%2Felm-msg-bug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmditch%2Felm-msg-bug/lists"}