Skip to content

feat(weather): allow manual latitude/longitude input#640

Open
saulob wants to merge 5 commits intofatihak:mainfrom
saulob:feature/weather-manual-location-input
Open

feat(weather): allow manual latitude/longitude input#640
saulob wants to merge 5 commits intofatihak:mainfrom
saulob:feature/weather-manual-location-input

Conversation

@saulob
Copy link
Copy Markdown

@saulob saulob commented Mar 28, 2026

Description

This PR improves the Weather plugin by allowing users to manually input latitude and longitude, instead of relying only on the map picker.

This change was inspired by the feature request discussed here: #564

What was done

  • Allow direct input of latitude and longitude
  • Remove readonly restriction from coordinate fields
  • Sync manually entered coordinates when opening the map modal (validated with Number.isFinite)
  • Reinitialize map view and marker when reopening with updated coordinates
  • Adjust zoom level dynamically based on coordinate presence. Prevents incorrect zoom when users add or remove coordinates after page load. Ensures the map view always matches the current state of the inputs

Why this matters

  • Fixes cases where Select Location may not work or appear blank
  • Improves usability by allowing quick manual input
  • Provides a fallback option without breaking existing behavior

Additional Notes

  • No breaking changes
  • Existing map selection flow remains unchanged
  • Manual input supports validation and proper error handling for invalid values
  • Invalid inputs (non-numeric values) are safely handled and return clear error messages without breaking the flow

Screenshots

  • Map picker automatically synced with manually entered coordinates
  • Successful update after entering coordinates directly in the input fields
2026-03-28_12-29_2 2026-03-28_12-29_3

- Remove readonly attribute from latitude and longitude inputs so users can type coordinates directly without using the map picker
- Re-read coordinate inputs when opening the map modal so manually  entered values are respected; validated with Number.isFinite
- Recalculate zoom level based on whether coordinates are present, matching mini_weather behavior (4.5 if set, 2.5 if not)
- Reinitialize map view and marker position when the map is already  initialized and reopened with updated coordinates
Copilot AI review requested due to automatic review settings March 28, 2026 15:35
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Weather plugin settings UI to support manually entering latitude/longitude while keeping the existing Leaflet map picker workflow.

Changes:

  • Makes latitude/longitude inputs editable (removes readonly).
  • Re-reads and syncs lat/long from inputs when opening the map modal, and refreshes the map view/marker on reopen.
  • Adjusts how saved settings populate the coordinate fields.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/plugins/weather/settings.html
Comment thread src/plugins/weather/settings.html Outdated
Comment thread src/plugins/weather/settings.html Outdated
Comment thread src/plugins/weather/settings.html Outdated
@saulob saulob marked this pull request as draft March 28, 2026 15:45
@saulob saulob marked this pull request as ready for review March 28, 2026 16:10
@saulob
Copy link
Copy Markdown
Author

saulob commented Mar 28, 2026

All Copilot review comments addressed

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.

2 participants