# Responsive Mobile Select Menu
**Contributors:** Jyria 
**Donate link:** https://www.saskialund.de/donate/  
**Tags:** responsive, menu, select, drop down, accessible mobile menu 
**Requires at least:** 6.5  
**Tested up to:** 6.8  
**Requires PHP:** 8.0  
**Stable tag:** 2.0.4  
**License:** GPLv2 or later  
**License URI:** https://www.gnu.org/licenses/gpl-2.0.html  
**Network:** false

**Mobile Menu Made Simple**

Your WordPress menu automatically becomes a touch-friendly dropdown on mobile devices. 

**Key Benefits:**
✅ Better mobile navigation
✅ No theme modifications needed
✅ Works with any WordPress menu
✅ Fully accessible
✅ Customizable breakpoint

**How it works:** The plugin detects when someone visits your site on a mobile device and automatically converts your menu into an easy-to-use dropdown. Desktop visitors see your normal menu unchanged.

**Perfect for:** Anyone who wants to improve their mobile site navigation without technical hassle.

## Description ##

**Mobile Menu Made Simple**

Your WordPress menu automatically becomes a touch-friendly dropdown on mobile devices. 

**Key Benefits:**
✅ Better mobile navigation
✅ No theme modifications needed
✅ Works with any WordPress menu
✅ Fully accessible
✅ Customizable breakpoint

**How it works:** The plugin detects when someone visits your site on a mobile device and automatically converts your menu into an easy-to-use dropdown. Desktop visitors see your normal menu unchanged.

**Perfect for:** Anyone who wants to improve their mobile site navigation without technical hassle.

**Technical note:** This plugin uses WordPress's native menu system and automatically detects screen size to show the appropriate menu format. It's built with modern WordPress standards and includes full accessibility support.

## 🚀 Version 2.0.0 - Complete Restructuring

### New Architecture

```
responsive-mobile-select-menu/
├── responsive-mobile-select-menu.php    # Main file with autoloader
├── includes/                            # Core classes
│   ├── class-plugin.php                 # Main plugin class
│   ├── class-settings.php               # Settings management
│   ├── class-menu-walker.php            # Custom menu walker
│   └── class-asset-manager.php          # Asset management
├── admin/                               # Admin area
│   ├── class-admin.php                  # Admin functionality
│   ├── views/
│   │   └── admin-page.php               # Admin interface
│   ├── css/
│   │   └── admin.css                    # Admin styles
│   └── js/
│       └── admin.js                     # Admin JavaScript
├── assets/                              # Frontend assets
│   ├── css/
│   │   └── responsive-menu.css          # Frontend styles
│   └── js/
│       └── responsive-menu.js           # Frontend JavaScript
└── languages/                           # Translations
    └── *.po, *.mo
```

### Technical Improvements

#### 🏗️ **Modern OOP Architecture**
- **Namespace**: `ResponsiveMobileSelect\`
- **Autoloader**: PSR-4 compatible
- **Dependency Injection**: Clean dependencies
- **Single Responsibility**: Each class has a clear purpose

#### 🔒 **Security & Standards**
- **WPCS Compliance**: Full WordPress Coding Standards
- **Input Validation**: Comprehensive sanitization
- **Nonce Verification**: Secure forms
- **Capability Checks**: Proper permission validation

#### ♿ **Accessibility (WCAG 2.1)**
- **ARIA Labels**: Full screen reader support
- **Keyboard Navigation**: Complete keyboard accessibility
- **High Contrast**: Support for high contrast modes
- **Reduced Motion**: Respects user preferences

#### 🎨 **Modern UI/UX**
- **Responsive Design**: Mobile-first approach
- **Dark Mode**: Support for dark modes
- **Touch Optimized**: Optimized for touch devices
- **Performance**: Optimized asset loading
- **Menu ID Support**: Works with both theme locations and specific menu IDs

### WordPress 6.5+ Compatibility

- ✅ **Block Themes**: Full FSE support
- ✅ **Site Editor**: Compatible with Full Site Editing
- ✅ **REST API**: Modern API integration
- ✅ **Hooks API**: Comprehensive filters and actions

### Developer API

#### Hooks & Filters

```php
// Customize breakpoint
add_filter('responsive_mobile_select_breakpoint', function($breakpoint) {
    return 768; // Custom breakpoint
});

// Modify menu locations
add_filter('responsive_mobile_select_locations', function($locations) {
    $locations[] = 'custom-location';
    return $locations;
});

// Custom CSS classes
add_filter('responsive_mobile_select_css_classes', function($classes) {
    $classes[] = 'my-custom-class';
    return $classes;
});
```

#### Actions

```php
// Before menu rendering
do_action('responsive_mobile_select_before_menu', $args);

// After menu rendering
do_action('responsive_mobile_select_after_menu', $args);

// Settings saved
do_action('responsive_mobile_select_settings_saved', $settings);
```

### Installation & Usage

1. **Install plugin** via WordPress Admin
2. **Activate plugin** under Plugins
3. **Configure settings** under Appearance > Responsive Menu
4. **Done!** The plugin works automatically

### Configuration

#### Basic Settings
- **Maximum Width**: Breakpoint for mobile view (320-1920px)
- **Placeholder Text**: Text for first select option
- **Indent Character**: Character for submenu indentation
- **Maximum Depth**: Limit of menu depth

#### Advanced Settings
- **Menu Locations**: Select specific theme locations
- **Exclude Empty Links**: Hide items without URL
- **Highlight Current Page**: Mark current page in select

### Performance Optimizations

- **Lazy Loading**: Load assets only when needed
- **Minification**: CSS/JS automatically optimized
- **Caching**: Efficient database queries
- **Debouncing**: Optimized event handlers

### Browser Compatibility

- ✅ **Chrome**: 90+
- ✅ **Firefox**: 88+
- ✅ **Safari**: 14+
- ✅ **Edge**: 90+
- ✅ **Mobile Safari**: 14+
- ✅ **Chrome Mobile**: 90+

### Support & Development

- **WordPress.org**: [Support Forum](https://wordpress.org/support/plugin/responsive-mobile-select-menu/)
- **GitHub**: [Issues & Pull Requests](https://github.com/saskialund/responsive-mobile-select-menu)
- **Website**: [Plugin Website](https://www.saskialund.de/responsive-mobile-select-menu/)

### License

GPL v2 or later - [License Details](https://www.gnu.org/licenses/gpl-2.0.html)

## Changelog

### 2.0.4 - Dropdown Behavior & User Experience
* **Dropdown behavior improvements** - Fixed confusing dropdown state persistence across page navigation
* **User experience enhancements** - Dropdown now correctly shows placeholder text on new pages
* **Intelligent state management** - Only saves and restores dropdown selection when actually on the target page
* **Automatic cleanup** - Removes stale localStorage entries when navigating away from saved pages
* **Intuitive navigation** - Dropdown always shows the correct state for the current page

### 2.0.3 - Critical Bug Fixes & Object Handling
* **Object handling improvements** - Proper handling of WordPress menu objects and WP_Term instances
* **String conversion safety** - Enhanced safe conversion of menu IDs and theme locations
* **Code robustness** - Improved error handling for various WordPress menu argument types
* **User experience** - Fixed dropdown visibility issues and placeholder text display

### 2.0.2 - Theme Compatibility & Responsive Fixes
* **Theme compatibility improvements** - Enhanced CSS class application for better theme compatibility
* **WordPress Codex compliance** - Improved menu modification using proper WordPress API parameters
* **Bug fixes** - Fixed responsive behavior where both desktop and mobile menus were displayed simultaneously
* **Code quality improvements** - Removed invasive HTML manipulation in favor of WordPress-standard approaches
* **Performance optimizations** - Streamlined menu rendering process

### 2.0.1 - Security & Bug Fixes
* **Security improvements** - Fixed $_SERVER variable sanitization in menu walker
* **Text domain consistency** - All translation strings now use 'responsive-mobile-select-menu'
* **Code quality improvements** - Enhanced input validation and sanitization
* **Plugin Check Plugin compliance** - Resolved all security warnings and coding standards issues
* **Repository cleanup** - Added .svnignore to prevent .DS_Store files from being committed
* **Bug fixes** - Fixed double menu display issue where option elements appeared in normal menu
* **Performance improvements** - Optimized menu walker to collect options without outputting them

### 2.0.0 - Complete Restructuring
* **Complete plugin rewrite** with modern architecture
* **WordPress 6.5+ compatibility** and block theme support
* **Full accessibility implementation** (WCAG 2.1 compliant)
* **Modern admin interface** with responsive design
* **Performance optimizations** and security enhancements
* **Developer-friendly API** with hooks and filters
* **Translation improvements** and internationalization
* **Mobile-first responsive design** with customizable breakpoints
* **Theme compatibility improvements** for modern themes
* **Code quality improvements** following WordPress Coding Standards
* **Menu ID support** - now works with both theme locations and specific menu IDs
* **Improved compatibility** - manual file loading for better server compatibility

---

**Developed with ❤️ by Saskia Teichmann**