Not a trivial thing to do just with Leaflet+Javascript.
The quickest thing that comes to my mind is using TurfJS to compute the distance between the point and a point on that line, for all your line geometries (iterating over them), and keep a reference to the feature using the closest geometry.
To put it all together like in this gist:
for(i = 0; i < featureCollection.features.length; i++){
var closestPoint = pointOnLine(linestring, featureCollection.features[i]);
var distance = distanceCalc(featureCollection.features[i], closestPoint, units);
if(distance < closestDistance || closestDistance === 0){
closestFeature = closestPoint;
closestDistance = distance;
}
}
This might be computationally expensive specially in those cases where you have lots of line segments around. If that's the case, use rbush to index the bboxes of your lines, and use a k-nearest-neighbour query to cull the amount of lines to check.
Another approach would be to generate a Voronoi diagram based on line segments beforehand (which is computationally expensive), index the bboxes of the areas, and do point-in-polygon queries (which are computationally cheaper than finding the closest point in a line segment).