@@ -491,11 +491,32 @@ function Browser() {
491491
492492 const onAddressSubmit = useCallback ( ( ) => {
493493 let entry = addressText . trim ( )
494- const isProbablyUrl = / ^ ( [ a - z ] + : \/ \/ | w w w \. | ( [ A - Z a - z 0 - 9 \- ] + \. ) + [ A - Z a - z ] { 2 , } ) ( \/ | $ ) / i. test ( entry )
495494
496- if ( entry === '' ) entry = kNEW_TAB_URL
497- else if ( ! isProbablyUrl ) entry = kGOOGLE_PREFIX + encodeURIComponent ( entry )
498- else if ( ! / ^ [ a - z ] + : \/ \/ / i. test ( entry ) ) entry = 'https://' + entry
495+ // Check if entry already has a protocol prefix
496+ const hasProtocol = / ^ [ a - z ] + : \/ \/ / i. test ( entry )
497+
498+ // Check for IP address format - basic IPv4 pattern
499+ const isIpAddress = / ^ \d { 1 , 3 } ( \. \d { 1 , 3 } ) { 3 } ( : \d + ) ? ( \/ .* ) ? $ / i. test ( entry )
500+
501+ // Check if it's likely a URL (protocol, www, domain, or IP address)
502+ const isProbablyUrl = hasProtocol || / ^ ( w w w \. | ( [ A - Z a - z 0 - 9 \- ] + \. ) + [ A - Z a - z ] { 2 , } ) ( \/ | $ ) / i. test ( entry ) || isIpAddress
503+
504+ if ( entry === '' ) {
505+ entry = kNEW_TAB_URL
506+ } else if ( ! isProbablyUrl ) {
507+ // Not a URL, treat as a search query
508+ entry = kGOOGLE_PREFIX + encodeURIComponent ( entry )
509+ } else if ( ! hasProtocol ) {
510+ // Add appropriate protocol based on whether it's an IP address or regular domain
511+ if ( isIpAddress ) {
512+ // For IP addresses, default to HTTP which is more common for local network devices
513+ entry = 'http://' + entry
514+ } else {
515+ // For regular domains, use HTTPS for security
516+ entry = 'https://' + entry
517+ }
518+ }
519+ // URLs with protocol (like https://) pass through unchanged
499520
500521 if ( ! isValidUrl ( entry ) ) {
501522 entry = kNEW_TAB_URL
@@ -614,9 +635,9 @@ function Browser() {
614635 const responderProps =
615636 addressFocused && keyboardVisible
616637 ? {
617- onStartShouldSetResponder : ( ) => true ,
618- onResponderRelease : dismissKeyboard
619- }
638+ onStartShouldSetResponder : ( ) => true ,
639+ onResponderRelease : dismissKeyboard
640+ }
620641 : { }
621642
622643 /* -------------------------------------------------------------------------- */
@@ -1217,7 +1238,7 @@ function Browser() {
12171238 title : navState . title || navState . url ,
12181239 url : navState . url ,
12191240 timestamp : Date . now ( )
1220- } ) . catch ( ( ) => { } )
1241+ } ) . catch ( ( ) => { } )
12211242 }
12221243 }
12231244
@@ -1723,7 +1744,9 @@ function Browser() {
17231744 flex : 1 ,
17241745 backgroundColor : colors . background ,
17251746 color : colors . textPrimary ,
1726- textAlign : addressFocused ? 'left' : 'center'
1747+ textAlign : addressFocused ? 'left' : 'center' ,
1748+ height : 40 , // Add explicit height for iOS
1749+ paddingVertical : 8 // Add padding for better appearance
17271750 }
17281751 ] }
17291752 placeholder = { t ( 'search_placeholder' ) }
0 commit comments